Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 625 Lines • ▼ Show 20 Lines | UnitAI.prototype.UnitFsmSpec = { | ||||
}, | }, | ||||
"Order.Garrison": function(msg) { | "Order.Garrison": function(msg) { | ||||
if (!this.AbleToMove()) | if (!this.AbleToMove()) | ||||
{ | { | ||||
this.SetNextState("IDLE"); | this.SetNextState("IDLE"); | ||||
return; | return; | ||||
} | } | ||||
else if (this.IsGarrisoned()) | |||||
if (this.IsGarrisoned()) | |||||
{ | { | ||||
if (this.IsAnimal()) | if (this.IsAnimal()) | ||||
this.SetNextState("ANIMAL.GARRISON.GARRISONED"); | this.SetNextState("ANIMAL.GARRISON.GARRISONED"); | ||||
else | else | ||||
this.SetNextState("INDIVIDUAL.GARRISON.GARRISONED"); | this.SetNextState("INDIVIDUAL.GARRISON.GARRISONED"); | ||||
return; | return; | ||||
} | } | ||||
// Also pack when we are in range. | |||||
if (this.CanPack()) | if (this.CanPack()) | ||||
{ | { | ||||
this.PushOrderFront("Pack", { "force": true }); | this.PushOrderFront("Pack", { "force": true }); | ||||
return; | return; | ||||
} | } | ||||
if (this.CheckGarrisonRange(this.order.data.target)) | |||||
{ | |||||
if (this.IsAnimal()) | |||||
this.SetNextState("ANIMAL.GARRISON.GARRISONED"); | |||||
else | |||||
this.SetNextState("INDIVIDUAL.GARRISON.GARRISONED"); | |||||
return; | |||||
} | |||||
if (this.IsAnimal()) | if (this.IsAnimal()) | ||||
this.SetNextState("ANIMAL.GARRISON.APPROACHING"); | this.SetNextState("ANIMAL.GARRISON.APPROACHING"); | ||||
else | else | ||||
this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING"); | this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING"); | ||||
}, | }, | ||||
"Order.Ungarrison": function() { | "Order.Ungarrison": function() { | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
▲ Show 20 Lines • Show All 5,933 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator