Use aiActionTime, instead of thinkTime, to allow waypoint to continue to spin.
This commit is contained in:
parent
e9c43f3d60
commit
bdced9c00f
|
@ -50,15 +50,18 @@ Entity *spawnWaypoint(void)
|
||||||
|
|
||||||
static void think(void)
|
static void think(void)
|
||||||
{
|
{
|
||||||
self->thinkTime = 4;
|
self->angle += 0.25;
|
||||||
|
|
||||||
self->angle++;
|
|
||||||
if (self->angle >= 360)
|
if (self->angle >= 360)
|
||||||
{
|
{
|
||||||
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->aiActionTime = 0;
|
||||||
|
|
||||||
|
if (self->health && player != NULL && getDistance(player->x, player->y, self->x, self->y) <= 128 && isCurrentObjective() && teamMatesClose())
|
||||||
{
|
{
|
||||||
self->health = 0;
|
self->health = 0;
|
||||||
|
|
||||||
|
@ -71,6 +74,7 @@ static void think(void)
|
||||||
battle.stats[STAT_WAYPOINTS_VISITED]++;
|
battle.stats[STAT_WAYPOINTS_VISITED]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int isCurrentObjective(void)
|
static int isCurrentObjective(void)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +83,7 @@ static int isCurrentObjective(void)
|
||||||
if (numActiveObjectives > 1)
|
if (numActiveObjectives > 1)
|
||||||
{
|
{
|
||||||
addHudMessage(colors.cyan, _("Cannot activate waypoint - outstanding objectives not yet complete"));
|
addHudMessage(colors.cyan, _("Cannot activate waypoint - outstanding objectives not yet complete"));
|
||||||
self->thinkTime = FPS;
|
self->aiActionTime = FPS;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +101,7 @@ static int teamMatesClose(void)
|
||||||
if (getDistance(player->x, player->y, e->x, e->y) > 350)
|
if (getDistance(player->x, player->y, e->x, e->y) > 350)
|
||||||
{
|
{
|
||||||
addHudMessage(colors.cyan, _("Cannot activate waypoint - team mates too far away"));
|
addHudMessage(colors.cyan, _("Cannot activate waypoint - team mates too far away"));
|
||||||
self->thinkTime = FPS;
|
self->aiActionTime = FPS;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue