Differential D4349 Diff 19135 ps/trunk/binaries/data/mods/public/simulation/components/Turretable.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Turretable.js
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | Turretable.prototype.OccupyTurret = function(target, turretPointName = "", ejectable = true) | ||||
if (!cmpTurretHolder || !cmpTurretHolder.OccupyNamedTurretPoint(this.entity, turretPointName)) | if (!cmpTurretHolder || !cmpTurretHolder.OccupyNamedTurretPoint(this.entity, turretPointName)) | ||||
return false; | return false; | ||||
this.holder = target; | this.holder = target; | ||||
this.ejectable = ejectable; | this.ejectable = ejectable; | ||||
let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
{ | |||||
cmpUnitAI.SetGarrisoned(); | |||||
cmpUnitAI.SetTurretStance(); | cmpUnitAI.SetTurretStance(); | ||||
} | |||||
let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | ||||
if (cmpUnitMotion) | if (cmpUnitMotion) | ||||
cmpUnitMotion.SetFacePointAfterMove(false); | cmpUnitMotion.SetFacePointAfterMove(false); | ||||
// Remove the unit's obstruction to avoid interfering with pathing. | // Remove the unit's obstruction to avoid interfering with pathing. | ||||
let cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | let cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | ||||
if (cmpObstruction) | if (cmpObstruction) | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if (cmpPosition) | ||||
if (cmpHolderPosition) | if (cmpHolderPosition) | ||||
cmpPosition.SetYRotation(cmpHolderPosition.GetPosition().horizAngleTo(pos)); | cmpPosition.SetYRotation(cmpHolderPosition.GetPosition().horizAngleTo(pos)); | ||||
} | } | ||||
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.ResetTurretStance(); | cmpUnitAI.ResetTurretStance(); | ||||
} | } | ||||
// Reset the obstruction flags to template defaults. | // Reset the obstruction flags to template defaults. | ||||
let cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | let cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | ||||
if (cmpObstruction) | if (cmpObstruction) | ||||
cmpObstruction.SetActive(true); | cmpObstruction.SetActive(true); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator