Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Garrisonable.js
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | Garrisonable.prototype.Garrison = function(target) | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
cmpUnitAI.SetGarrisoned(); | cmpUnitAI.SetGarrisoned(); | ||||
let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
cmpPosition.MoveOutOfWorld(); | cmpPosition.MoveOutOfWorld(); | ||||
Engine.PostMessage(this.entity, MT_GarrisonedStateChanged, { | Engine.PostMessage(this.entity, MT_GarrisonedStateChanged, { | ||||
"entity": this.entity, | |||||
"oldHolder": INVALID_ENTITY, | "oldHolder": INVALID_ENTITY, | ||||
"holderID": target | "holderID": target | ||||
}); | }); | ||||
return true; | return true; | ||||
}; | }; | ||||
/** | /** | ||||
Show All 27 Lines | Garrisonable.prototype.UnGarrison = function(forced = false) | ||||
let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
{ | { | ||||
cmpUnitAI.Ungarrison(); | cmpUnitAI.Ungarrison(); | ||||
cmpUnitAI.UnsetGarrisoned(); | cmpUnitAI.UnsetGarrisoned(); | ||||
} | } | ||||
Engine.PostMessage(this.entity, MT_GarrisonedStateChanged, { | Engine.PostMessage(this.entity, MT_GarrisonedStateChanged, { | ||||
"entity": this.entity, | |||||
"oldHolder": this.holder, | "oldHolder": this.holder, | ||||
"holderID": INVALID_ENTITY | "holderID": INVALID_ENTITY | ||||
}); | }); | ||||
let cmpRallyPoint = Engine.QueryInterface(this.holder, IID_RallyPoint); | let cmpRallyPoint = Engine.QueryInterface(this.holder, IID_RallyPoint); | ||||
// Need to delete this before ordering to a rally | // Need to delete this before ordering to a rally | ||||
// point else we may not garrison another entity. | // point else we may not garrison another entity. | ||||
Show All 21 Lines |
Wildfire Games · Phabricator