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