Allow AI to fire rockets.
This commit is contained in:
parent
bbd61bf8ba
commit
f304e8ca5b
|
@ -372,16 +372,31 @@ static void preAttack(void)
|
|||
{
|
||||
if (!self->reload)
|
||||
{
|
||||
/* force weapon selection, otherwise we'll keep using lasers / mag */
|
||||
canAttack(self->target);
|
||||
|
||||
if (self->guns[0].type && (self->missiles == 0 || rand() % 50 > 0))
|
||||
if (!(self->aiFlags & AIF_MISSILE_BOAT))
|
||||
{
|
||||
fireGuns(self);
|
||||
/* force weapon selection, otherwise we'll keep using lasers / mag */
|
||||
canAttack(self->target);
|
||||
|
||||
if (self->guns[0].type && (self->missiles == 0 || rand() % 50 > 0))
|
||||
{
|
||||
fireGuns(self);
|
||||
}
|
||||
else if (self->missiles)
|
||||
{
|
||||
fireMissile(self);
|
||||
}
|
||||
}
|
||||
else if (self->missiles)
|
||||
else
|
||||
{
|
||||
fireMissile(self);
|
||||
fireRocket(self);
|
||||
|
||||
self->reload = FPS;
|
||||
|
||||
/* don't constantly fire rockets like normal guns */
|
||||
if (rand() % 5)
|
||||
{
|
||||
self->action = doAI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ extern int mod(int n, int x);
|
|||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void fireGuns(Entity *owner);
|
||||
extern void fireMissile(Entity *owner);
|
||||
extern void fireRocket(Entity *owner);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern void applyFighterThrust(void);
|
||||
extern void applyFighterBrakes(void);
|
||||
|
|
Loading…
Reference in New Issue