Don't exceed your own speed when following a leader.
This commit is contained in:
parent
e56e64ee05
commit
6d8856deae
|
@ -709,7 +709,9 @@ static void moveToPlayer(void)
|
|||
|
||||
turnToFace(wantedAngle);
|
||||
|
||||
if (player->thrust)
|
||||
if (player->thrust > 0.1)
|
||||
{
|
||||
if (self->speed > player->speed)
|
||||
{
|
||||
oldSpeed = self->speed;
|
||||
self->speed = sqrt(player->thrust);
|
||||
|
@ -717,6 +719,11 @@ static void moveToPlayer(void)
|
|||
self->speed = oldSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
applyFighterThrust();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
applyFighterBrakes();
|
||||
}
|
||||
|
@ -905,18 +912,25 @@ static void moveToLeader(void)
|
|||
|
||||
if (dist <= ((self->leader->type != ET_CAPITAL_SHIP) ? 350 : 550))
|
||||
{
|
||||
if (self->leader->thrust)
|
||||
if (self->leader->thrust > 0.1)
|
||||
{
|
||||
wantedAngle = getAngle(self->leader->x, self->leader->y, self->leader->x + (self->leader->dx * 1000), self->leader->y + (self->leader->dy * 1000));
|
||||
|
||||
turnToFace(wantedAngle);
|
||||
|
||||
if (self->speed > self->leader->speed)
|
||||
{
|
||||
oldSpeed = self->speed;
|
||||
self->speed = sqrt(self->leader->thrust);
|
||||
applyFighterThrust();
|
||||
self->speed = oldSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
applyFighterThrust();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
applyFighterBrakes();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue