Better fleeing to witchspace for grouped ships
This commit is contained in:
parent
632bec9918
commit
f3d1180b28
@ -3051,6 +3051,27 @@ PriorityAIController.prototype.behaviourFleeCombat = function()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.ship.group && this.ship.group.leader && this.ship.group.leader != this.ship)
|
||||
{
|
||||
var leader = this.ship.group.leader;
|
||||
if (leader.status == "STATUS_ENTERING_WITCHSPACE")
|
||||
{
|
||||
var wormholes = system.wormholes;
|
||||
for (var i=0;i<wormholes.count;i++)
|
||||
{
|
||||
var wormhole = wormholes[i];
|
||||
if (wormhole.expiryTime > clock.seconds && wormhole.position.distanceTo(leader) < 100 && wormhole.position.distanceTo(this.ship) < this.scannerRange)
|
||||
{
|
||||
// if the leader has departed and the wormhole is
|
||||
// reachable, go for it!
|
||||
this.ship.destination = wormhole.position;
|
||||
this.ship.desiredSpeed = this.ship.maxFlightSpeed * 7;
|
||||
this.ship.performFlyToRangeFromDestination();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.ship.desiredRange = this.scannerRange;
|
||||
this.ship.performFlee();
|
||||
|
Loading…
x
Reference in New Issue
Block a user