Allow AI controlled tug to collect disabled fighters, and take them to the extraction point.
This commit is contained in:
parent
d8783cc557
commit
3ef305686f
|
@ -14,5 +14,5 @@
|
|||
}
|
||||
],
|
||||
"flags" : "EF_HAS_ROPE",
|
||||
"aiFlags" : "AIF_AVOIDS_COMBAT"
|
||||
"aiFlags" : "AIF_AVOIDS_COMBAT+AIF_TOWS"
|
||||
}
|
||||
|
|
|
@ -68,9 +68,12 @@ void doAI(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((self->aiFlags & AIF_TOWS) && nearTowableCraft())
|
||||
if (self->aiFlags & AIF_TOWS)
|
||||
{
|
||||
return;
|
||||
if (!self->towing && nearTowableCraft())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((self->aiFlags & AIF_RETREATS) && (battle.stats[STAT_TIME] % 60 == 0) && isRetreating())
|
||||
|
@ -592,7 +595,7 @@ static int nearTowableCraft(void)
|
|||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
{
|
||||
if (e->type == ET_FIGHTER && (e->flags & EF_DISABLED))
|
||||
if (e->type == ET_FIGHTER && (e->flags & (EF_DISABLED|EF_MISSION_TARGET)) == (EF_DISABLED|EF_MISSION_TARGET))
|
||||
{
|
||||
distance = getDistance(self->x, self->y, e->x, e->y);
|
||||
|
||||
|
@ -618,6 +621,8 @@ static void moveToTowableCraft(void)
|
|||
faceTarget(self->target);
|
||||
|
||||
applyFighterThrust();
|
||||
|
||||
nextAction();
|
||||
}
|
||||
|
||||
static void lookForPlayer(void)
|
||||
|
|
|
@ -40,6 +40,10 @@ void attachRope(void)
|
|||
self->towing = e;
|
||||
e->owner = self;
|
||||
|
||||
self->aiFlags |= AIF_GOAL_EXTRACTION;
|
||||
|
||||
e->flags |= EF_RETREATING;
|
||||
|
||||
if (self == player)
|
||||
{
|
||||
battle.stats[STAT_NUM_TOWED]++;
|
||||
|
@ -92,6 +96,7 @@ void cutRope(Entity *e)
|
|||
if (e->owner && e->owner->towing == e)
|
||||
{
|
||||
e->owner->towing = NULL;
|
||||
e->owner->aiFlags &= ~AIF_GOAL_EXTRACTION;
|
||||
e->owner = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue