Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Garrisonable.js
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | Garrisonable.prototype.Garrison = function(entity, renamed = false) | ||||
let cmpAura = Engine.QueryInterface(this.entity, IID_Auras); | let cmpAura = Engine.QueryInterface(this.entity, IID_Auras); | ||||
if (cmpAura && cmpAura.HasGarrisonAura()) | if (cmpAura && cmpAura.HasGarrisonAura()) | ||||
cmpAura.ApplyGarrisonAura(entity); | cmpAura.ApplyGarrisonAura(entity); | ||||
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, { | |||||
"holder": entity | |||||
}); | |||||
if (renamed) | if (renamed) | ||||
return true; | return true; | ||||
let cmpTurretHolder = Engine.QueryInterface(entity, IID_TurretHolder); | let cmpTurretHolder = Engine.QueryInterface(entity, IID_TurretHolder); | ||||
if (cmpTurretHolder) | if (cmpTurretHolder) | ||||
cmpTurretHolder.OccupyTurret(this.entity); | cmpTurretHolder.OccupyTurret(this.entity); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | Garrisonable.prototype.UnGarrison = function(forced = false, renamed = false) | ||||
let cmpProductionQueue = Engine.QueryInterface(this.entity, IID_ProductionQueue); | let cmpProductionQueue = Engine.QueryInterface(this.entity, IID_ProductionQueue); | ||||
if (cmpProductionQueue) | if (cmpProductionQueue) | ||||
cmpProductionQueue.UnpauseProduction(); | cmpProductionQueue.UnpauseProduction(); | ||||
let cmpAura = Engine.QueryInterface(this.entity, IID_Auras); | let cmpAura = Engine.QueryInterface(this.entity, IID_Auras); | ||||
if (cmpAura && cmpAura.HasGarrisonAura()) | if (cmpAura && cmpAura.HasGarrisonAura()) | ||||
cmpAura.RemoveGarrisonAura(this.holder); | cmpAura.RemoveGarrisonAura(this.holder); | ||||
Engine.PostMessage(this.entity, MT_GarrisonedStateChanged, { | |||||
"holder": INVALID_ENTITY | |||||
}); | |||||
if (renamed) | if (renamed) | ||||
return true; | return true; | ||||
let cmpTurretHolder = Engine.QueryInterface(this.holder, IID_TurretHolder); | let cmpTurretHolder = Engine.QueryInterface(this.holder, IID_TurretHolder); | ||||
if (cmpTurretHolder) | if (cmpTurretHolder) | ||||
cmpTurretHolder.LeaveTurret(this.entity); | cmpTurretHolder.LeaveTurret(this.entity); | ||||
cmpGarrisonHolder.OrderToRallyPoint(this.entity); | cmpGarrisonHolder.OrderToRallyPoint(this.entity); | ||||
Show All 32 Lines |
Wildfire Games · Phabricator