Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | "OrderTargetRenamed": function() { | ||||
// so that state preconditions are checked against the new entity | // so that state preconditions are checked against the new entity | ||||
// (there is no reason to assume the target is still valid). | // (there is no reason to assume the target is still valid). | ||||
this.SetNextState(this.GetCurrentState()); | this.SetNextState(this.GetCurrentState()); | ||||
}, | }, | ||||
// Formation handlers: | // Formation handlers: | ||||
"FormationLeave": function(msg) { | "FormationLeave": function(msg) { | ||||
// ignore when we're not in FORMATIONMEMBER | // Overloaded by FORMATIONMEMBER | ||||
// We end up here if LeaveFormation was called when the entity | |||||
// was executing an order in an individual state, so we must | |||||
// discard the order now that it has been executed. | |||||
if (this.order && this.order.type === "LeaveFormation") | |||||
this.FinishOrder(); | |||||
}, | }, | ||||
// Called when being told to walk as part of a formation | // Called when being told to walk as part of a formation | ||||
"Order.FormationWalk": function(msg) { | "Order.FormationWalk": function(msg) { | ||||
if (!this.AbleToMove()) | if (!this.AbleToMove()) | ||||
{ | { | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
return; | return; | ||||
Show All 29 Lines | if (!this.IsFormationMember()) | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
return; | return; | ||||
} | } | ||||
let cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation); | let cmpFormation = Engine.QueryInterface(this.formationController, IID_Formation); | ||||
if (cmpFormation) | if (cmpFormation) | ||||
{ | { | ||||
cmpFormation.SetRearrange(false); | cmpFormation.SetRearrange(false); | ||||
// Calls FinishOrder(); | // Triggers FormationLeave, which ultimately will FinishOrder, | ||||
// discarding this order. | |||||
cmpFormation.RemoveMembers([this.entity]); | cmpFormation.RemoveMembers([this.entity]); | ||||
cmpFormation.SetRearrange(true); | cmpFormation.SetRearrange(true); | ||||
} | } | ||||
}, | }, | ||||
"Order.Stop": function(msg) { | "Order.Stop": function(msg) { | ||||
this.StopMoving(); | this.StopMoving(); | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
▲ Show 20 Lines • Show All 6,300 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator