Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GarrisonHolder.js
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | if (pos.y < 0) | ||||
// If ejection is forced, we need to continue, so use center of the building | // If ejection is forced, we need to continue, so use center of the building | ||||
let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||
pos = cmpPosition.GetPosition(); | pos = cmpPosition.GetPosition(); | ||||
} | } | ||||
this.entities.splice(entityIndex, 1); | this.entities.splice(entityIndex, 1); | ||||
let cmpEntUnitAI = Engine.QueryInterface(entity, IID_UnitAI); | |||||
if (cmpEntUnitAI) | |||||
cmpEntUnitAI.Ungarrison(); | |||||
let cmpEntProductionQueue = Engine.QueryInterface(entity, IID_ProductionQueue); | |||||
if (cmpEntProductionQueue) | |||||
cmpEntProductionQueue.UnpauseProduction(); | |||||
Freagarach: Why did you need to move this? It seems wrong to have it after the message. | |||||
Done Inline ActionsBasically because it doesn't work. wraitii: Basically because it doesn't work.
UnitAI.Ungarrison calls "SetImmobile(false)", which ought to… | |||||
Not Done Inline ActionsSo it seems that would be fixed by only setting Immobile to false when we actually leave the garrisoned state? Freagarach: So it seems that would be fixed by only setting Immobile to false when we actually leave the… | |||||
Done Inline ActionsWell, yes, but that happens on UnitAI.Ungarrison. You could listen to the message, but you have no guaranteed on order. You could have an "ungarrisoned" message, but it doesn't seem very necessary at the moment. wraitii: Well, yes, but that happens on UnitAI.Ungarrison. You could listen to the message, but you have… | |||||
let cmpEntAura = Engine.QueryInterface(entity, IID_Auras); | let cmpEntAura = Engine.QueryInterface(entity, IID_Auras); | ||||
if (cmpEntAura && cmpEntAura.HasGarrisonAura()) | if (cmpEntAura && cmpEntAura.HasGarrisonAura()) | ||||
cmpEntAura.RemoveGarrisonAura(this.entity); | cmpEntAura.RemoveGarrisonAura(this.entity); | ||||
let cmpEntPosition = Engine.QueryInterface(entity, IID_Position); | let cmpEntPosition = Engine.QueryInterface(entity, IID_Position); | ||||
if (cmpEntPosition) | if (cmpEntPosition) | ||||
{ | { | ||||
cmpEntPosition.JumpTo(pos.x, pos.z); | cmpEntPosition.JumpTo(pos.x, pos.z); | ||||
cmpEntPosition.SetHeightOffset(0); | cmpEntPosition.SetHeightOffset(0); | ||||
let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
cmpEntPosition.SetYRotation(cmpPosition.GetPosition().horizAngleTo(pos)); | cmpEntPosition.SetYRotation(cmpPosition.GetPosition().horizAngleTo(pos)); | ||||
} | } | ||||
Engine.PostMessage(this.entity, MT_GarrisonedUnitsChanged, { | Engine.PostMessage(this.entity, MT_GarrisonedUnitsChanged, { | ||||
"added": [], | "added": [], | ||||
"removed": [entity], | "removed": [entity], | ||||
"renamed": renamed | "renamed": renamed | ||||
}); | }); | ||||
// These should be called after the unit has been moved back into the world. | |||||
let cmpEntUnitAI = Engine.QueryInterface(entity, IID_UnitAI); | |||||
if (cmpEntUnitAI) | |||||
cmpEntUnitAI.Ungarrison(); | |||||
let cmpEntProductionQueue = Engine.QueryInterface(entity, IID_ProductionQueue); | |||||
if (cmpEntProductionQueue) | |||||
cmpEntProductionQueue.UnpauseProduction(); | |||||
return true; | return true; | ||||
}; | }; | ||||
/** | /** | ||||
* Ejects units and orders them to move to the rally point. If an ejection | * Ejects units and orders them to move to the rally point. If an ejection | ||||
* with a given obstruction radius has failed, we won't try anymore to eject | * with a given obstruction radius has failed, we won't try anymore to eject | ||||
* entities with a bigger obstruction as that is compelled to also fail. | * entities with a bigger obstruction as that is compelled to also fail. | ||||
* @param {Array} entities - An array containing the ids of the entities to eject. | * @param {Array} entities - An array containing the ids of the entities to eject. | ||||
▲ Show 20 Lines • Show All 402 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Why did you need to move this? It seems wrong to have it after the message.