Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 628 Lines • ▼ Show 20 Lines | "Order.Garrison": function(msg) { | ||||
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(); | ||||
this.isGarrisoned = false; | this.isGarrisoned = false; | ||||
this.SetImmobile(false); | |||||
bb: Seems sane to have these here, but why are they behing the finishOrder? So we are well in the… | |||||
wraitiiAuthorUnsubmitted Done Inline ActionsMmh. FinishOrder here doesn't actually move us onto the next _state_, it just processes the order to set up the next state change, so this is probably fine. I'll see if they can easily be moved above or if that breaks something. wraitii: Mmh. FinishOrder here doesn't actually move us onto the next _state_, it just processes the… | |||||
FreagarachUnsubmitted Not Done Inline Actions
That breaks. See D2368. I'm working towards fixing that, actually.
busy with that also ;) Freagarach: > The truth is these should probably be in the "leave" of the garrison state.
That breaks. See… | |||||
}, | }, | ||||
"Order.Cheer": function(msg) { | "Order.Cheer": function(msg) { | ||||
return { "discardOrder": true }; | return { "discardOrder": true }; | ||||
}, | }, | ||||
"Order.Pack": function(msg) { | "Order.Pack": function(msg) { | ||||
if (this.CanPack()) | if (this.CanPack()) | ||||
▲ Show 20 Lines • Show All 2,769 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/** | /** | ||||
* @param cmpUnitMotion - optionally pass unitMotion to avoid querying it here | * @param cmpUnitMotion - optionally pass unitMotion to avoid querying it here | ||||
* @returns true if the entity can move, i.e. has UnitMotion and isn't immobile. | * @returns true if the entity can move, i.e. has UnitMotion and isn't immobile. | ||||
*/ | */ | ||||
UnitAI.prototype.AbleToMove = function(cmpUnitMotion) | UnitAI.prototype.AbleToMove = function(cmpUnitMotion) | ||||
{ | { | ||||
if (this.isImmobile || this.IsTurret()) | if (this.isImmobile || this.IsTurret()) | ||||
Done Inline Actions:p wraitii: :p | |||||
return false; | return false; | ||||
if (!cmpUnitMotion) | if (!cmpUnitMotion) | ||||
cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | ||||
return !!cmpUnitMotion; | return !!cmpUnitMotion; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 1,949 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/** | /** | ||||
* Adds ungarrison order to the queue. | * Adds ungarrison order to the queue. | ||||
*/ | */ | ||||
UnitAI.prototype.Ungarrison = function() | UnitAI.prototype.Ungarrison = function() | ||||
{ | { | ||||
if (this.IsGarrisoned()) | if (this.IsGarrisoned()) | ||||
{ | |||||
this.SetImmobile(false); | |||||
this.AddOrder("Ungarrison", null, false); | this.AddOrder("Ungarrison", null, false); | ||||
} | |||||
}; | }; | ||||
/** | /** | ||||
* Adds a garrison order for units that are already garrisoned in the garrison holder. | * Adds a garrison order for units that are already garrisoned in the garrison holder. | ||||
*/ | */ | ||||
UnitAI.prototype.Autogarrison = function(target) | UnitAI.prototype.Autogarrison = function(target) | ||||
{ | { | ||||
this.isGarrisoned = true; | this.isGarrisoned = true; | ||||
▲ Show 20 Lines • Show All 992 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Seems sane to have these here, but why are they behing the finishOrder? So we are well in the next order and still set it?