From bdced9c00f27727a1e3510855a0c076785796885 Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 12 Mar 2016 12:11:56 +0000 Subject: [PATCH] Use aiActionTime, instead of thinkTime, to allow waypoint to continue to spin. --- src/battle/waypoints.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/battle/waypoints.c b/src/battle/waypoints.c index cd87001..70226d4 100644 --- a/src/battle/waypoints.c +++ b/src/battle/waypoints.c @@ -50,25 +50,29 @@ Entity *spawnWaypoint(void) static void think(void) { - self->thinkTime = 4; + self->angle += 0.25; - self->angle++; if (self->angle >= 360) { self->angle -= 360; } - if (player != NULL && getDistance(player->x, player->y, self->x, self->y) <= 64 && isCurrentObjective() && teamMatesClose()) + if (--self->aiActionTime <= 0) { - self->health = 0; + self->aiActionTime = 0; - updateObjective("Waypoint", TT_WAYPOINT); - - runScriptFunction(self->name); - - activateNextWaypoint(self->id); - - battle.stats[STAT_WAYPOINTS_VISITED]++; + if (self->health && player != NULL && getDistance(player->x, player->y, self->x, self->y) <= 128 && isCurrentObjective() && teamMatesClose()) + { + self->health = 0; + + updateObjective("Waypoint", TT_WAYPOINT); + + runScriptFunction(self->name); + + activateNextWaypoint(self->id); + + battle.stats[STAT_WAYPOINTS_VISITED]++; + } } } @@ -79,7 +83,7 @@ static int isCurrentObjective(void) if (numActiveObjectives > 1) { addHudMessage(colors.cyan, _("Cannot activate waypoint - outstanding objectives not yet complete")); - self->thinkTime = FPS; + self->aiActionTime = FPS; return 0; } @@ -97,7 +101,7 @@ static int teamMatesClose(void) if (getDistance(player->x, player->y, e->x, e->y) > 350) { addHudMessage(colors.cyan, _("Cannot activate waypoint - team mates too far away")); - self->thinkTime = FPS; + self->aiActionTime = FPS; return 0; } }