Fix the LeaveFoundation order in UnitAI in the case of animals. The code used was a hack using the fleeing tactics, so use the regular "Order.LeaveFoundation" code shared with non-animal units.

Fixes #3372

This was SVN commit r16973.
This commit is contained in:
Nicolas Auvray 2015-09-02 17:36:20 +00:00
parent bcc75b2156
commit 0c4c6e499d

View File

@ -3027,9 +3027,18 @@ UnitAI.prototype.UnitFsmSpec = {
},
"Order.LeaveFoundation": function(msg) {
// Run away from the foundation
this.FinishOrder();
this.PushOrderFront("Flee", { "target": msg.data.target, "force": false });
// Move a tile outside the building
var range = 4;
if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
{
// We've started walking to the given point
this.SetNextState("WALKING");
}
else
{
// We are already at the target, or can't move at all
this.FinishOrder();
}
},
"IDLE": {