Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GarrisonHolder.js
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Lines | if (visibleGarrisonPoint) | ||||
let cmpUnitMotion = Engine.QueryInterface(entity, IID_UnitMotion); | let cmpUnitMotion = Engine.QueryInterface(entity, IID_UnitMotion); | ||||
if (cmpUnitMotion) | if (cmpUnitMotion) | ||||
cmpUnitMotion.SetFacePointAfterMove(false); | cmpUnitMotion.SetFacePointAfterMove(false); | ||||
cmpPosition.SetTurretParent(this.entity, visibleGarrisonPoint.offset); | cmpPosition.SetTurretParent(this.entity, visibleGarrisonPoint.offset); | ||||
let cmpUnitAI = Engine.QueryInterface(entity, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(entity, IID_UnitAI); | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
cmpUnitAI.SetTurretStance(); | cmpUnitAI.SetTurretStance(); | ||||
// Remove the unit's obstruction to avoid interfering with pathing. | |||||
let cmpObstruction = Engine.QueryInterface(entity, IID_Obstruction); | |||||
if (cmpObstruction) | |||||
cmpObstruction.SetDisableBlockMovementPathfinding(true, true, -1); | |||||
isVisiblyGarrisoned = true; | isVisiblyGarrisoned = true; | ||||
} | } | ||||
else | else | ||||
cmpPosition.MoveOutOfWorld(); | cmpPosition.MoveOutOfWorld(); | ||||
// Should only be called after the garrison has been performed else the visible Garrison Points are not updated yet. | // Should only be called after the garrison has been performed else the visible Garrison Points are not updated yet. | ||||
Engine.PostMessage(this.entity, MT_GarrisonedUnitsChanged, { | Engine.PostMessage(this.entity, MT_GarrisonedUnitsChanged, { | ||||
"added": [entity], | "added": [entity], | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | for (let vgp of this.visibleGarrisonPoints) | ||||
if (cmpEntUnitMotion) | if (cmpEntUnitMotion) | ||||
cmpEntUnitMotion.SetFacePointAfterMove(true); | cmpEntUnitMotion.SetFacePointAfterMove(true); | ||||
if (cmpEntUnitAI) | if (cmpEntUnitAI) | ||||
cmpEntUnitAI.ResetTurretStance(); | cmpEntUnitAI.ResetTurretStance(); | ||||
vgp.entity = null; | vgp.entity = null; | ||||
break; | break; | ||||
} | } | ||||
// Reset the obstruction flags to template defaults. | |||||
let cmpObstruction = Engine.QueryInterface(entity, IID_Obstruction); | |||||
if (cmpObstruction) | |||||
cmpObstruction.SetDisableBlockMovementPathfinding(false, false, -1); | |||||
if (cmpEntUnitAI) | if (cmpEntUnitAI) | ||||
cmpEntUnitAI.Ungarrison(); | cmpEntUnitAI.Ungarrison(); | ||||
let cmpEntProductionQueue = Engine.QueryInterface(entity, IID_ProductionQueue); | let cmpEntProductionQueue = Engine.QueryInterface(entity, IID_ProductionQueue); | ||||
if (cmpEntProductionQueue) | if (cmpEntProductionQueue) | ||||
cmpEntProductionQueue.UnpauseProduction(); | cmpEntProductionQueue.UnpauseProduction(); | ||||
let cmpEntAura = Engine.QueryInterface(entity, IID_Auras); | let cmpEntAura = Engine.QueryInterface(entity, IID_Auras); | ||||
▲ Show 20 Lines • Show All 431 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator