Changeset View
Standalone View
binaries/data/mods/public/simulation/components/GuiInterface.js
Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | GuiInterface.prototype.GetEntityState = function(player, ent) | ||||
let cmpCapturable = QueryMiragedInterface(ent, IID_Capturable); | let cmpCapturable = QueryMiragedInterface(ent, IID_Capturable); | ||||
if (cmpCapturable) | if (cmpCapturable) | ||||
{ | { | ||||
ret.capturePoints = cmpCapturable.GetCapturePoints(); | ret.capturePoints = cmpCapturable.GetCapturePoints(); | ||||
ret.maxCapturePoints = cmpCapturable.GetMaxCapturePoints(); | ret.maxCapturePoints = cmpCapturable.GetMaxCapturePoints(); | ||||
} | } | ||||
let cmpBattalionManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_BattalionManager); | |||||
ret.battalion = cmpBattalionManager.PartOfBattalion(ent); | |||||
let cmpBuilder = Engine.QueryInterface(ent, IID_Builder); | let cmpBuilder = Engine.QueryInterface(ent, IID_Builder); | ||||
if (cmpBuilder) | if (cmpBuilder) | ||||
ret.builder = true; | ret.builder = true; | ||||
let cmpMarket = QueryMiragedInterface(ent, IID_Market); | let cmpMarket = QueryMiragedInterface(ent, IID_Market); | ||||
if (cmpMarket) | if (cmpMarket) | ||||
ret.market = { | ret.market = { | ||||
"land": cmpMarket.HasType("land"), | "land": cmpMarket.HasType("land"), | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | ret.unitAI = { | ||||
"state": cmpUnitAI.GetCurrentState(), | "state": cmpUnitAI.GetCurrentState(), | ||||
"orders": cmpUnitAI.GetOrders(), | "orders": cmpUnitAI.GetOrders(), | ||||
"hasWorkOrders": cmpUnitAI.HasWorkOrders(), | "hasWorkOrders": cmpUnitAI.HasWorkOrders(), | ||||
"canGuard": cmpUnitAI.CanGuard(), | "canGuard": cmpUnitAI.CanGuard(), | ||||
"isGuarding": cmpUnitAI.IsGuardOf(), | "isGuarding": cmpUnitAI.IsGuardOf(), | ||||
"canPatrol": cmpUnitAI.CanPatrol(), | "canPatrol": cmpUnitAI.CanPatrol(), | ||||
"selectableStances": cmpUnitAI.GetSelectableStances(), | "selectableStances": cmpUnitAI.GetSelectableStances(), | ||||
"isIdle": cmpUnitAI.IsIdle() | "isIdle": cmpUnitAI.IsIdle() | ||||
}; | }; | ||||
Stan: Can't you just pass the members here? | |||||
Done Inline ActionsThis is the formation controller that controls an entity. Freagarach: This is the formation controller that controls an entity. | |||||
let cmpGuard = Engine.QueryInterface(ent, IID_Guard); | let cmpGuard = Engine.QueryInterface(ent, IID_Guard); | ||||
if (cmpGuard) | if (cmpGuard) | ||||
ret.guard = { | ret.guard = { | ||||
"entities": cmpGuard.GetEntities() | "entities": cmpGuard.GetEntities() | ||||
}; | }; | ||||
let cmpResourceGatherer = Engine.QueryInterface(ent, IID_ResourceGatherer); | let cmpResourceGatherer = Engine.QueryInterface(ent, IID_ResourceGatherer); | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | GuiInterface.prototype.GetEntityState = function(player, ent) | ||||
let cmpUnitMotion = Engine.QueryInterface(ent, IID_UnitMotion); | let cmpUnitMotion = Engine.QueryInterface(ent, IID_UnitMotion); | ||||
if (cmpUnitMotion) | if (cmpUnitMotion) | ||||
ret.speed = { | ret.speed = { | ||||
"walk": cmpUnitMotion.GetWalkSpeed(), | "walk": cmpUnitMotion.GetWalkSpeed(), | ||||
"run": cmpUnitMotion.GetWalkSpeed() * cmpUnitMotion.GetRunMultiplier() | "run": cmpUnitMotion.GetWalkSpeed() * cmpUnitMotion.GetRunMultiplier() | ||||
}; | }; | ||||
let cmpUpkeep = Engine.QueryInterface(ent, IID_Upkeep); | let cmpUpkeep = Engine.QueryInterface(ent, IID_Upkeep); | ||||
if (cmpUpkeep) | if (cmpUpkeep) | ||||
Done Inline ActionsDo we want more information in the state? Freagarach: Do we want more information in the state? | |||||
Done Inline ActionsMaybe the bataillion average health ? Stan: Maybe the bataillion average health ? | |||||
Done Inline ActionsI guess that is more of an implementation thing. This aims to be the support where that stands on. For now there is little use in things like health, XP and such. Freagarach: I guess that is more of an implementation thing. This aims to be the support where that stands… | |||||
Done Inline ActionsIn this case yeah it only makes sense to share whether the unit is a part of a bataillon or not. Stan: In this case yeah it only makes sense to share whether the unit is a part of a bataillon or not. | |||||
Done Inline ActionsWould be cool :) But when multiple groups (or one group and a few loose entities) of the same species are selected it would become vague. Freagarach: Would be cool :) But when multiple groups (or one group and a few loose entities) of the same… | |||||
Done Inline ActionsWell it depends on the icon variety. Stan: Well it depends on the icon variety. | |||||
Done Inline ActionsI'm aiming for a flag or something above one of the entities of a group. Freagarach: I'm aiming for a flag or something above one of the entities of a group. | |||||
ret.upkeep = { | ret.upkeep = { | ||||
"interval": cmpUpkeep.GetInterval(), | "interval": cmpUpkeep.GetInterval(), | ||||
"rates": cmpUpkeep.GetRates() | "rates": cmpUpkeep.GetRates() | ||||
}; | }; | ||||
return ret; | return ret; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 437 Lines • ▼ Show 20 Lines | GuiInterface.prototype.GetPlayerEntities = function(player) | ||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(player); | return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(player); | ||||
}; | }; | ||||
GuiInterface.prototype.GetNonGaiaEntities = function() | GuiInterface.prototype.GetNonGaiaEntities = function() | ||||
{ | { | ||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetNonGaiaEntities(); | return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetNonGaiaEntities(); | ||||
}; | }; | ||||
GuiInterface.prototype.GetBattalions = function(player, data) | |||||
{ | |||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_BattalionManager).GetBattalions(data.players); | |||||
}; | |||||
/** | /** | ||||
* Displays the rally points of a given list of entities (carried in cmd.entities). | * Displays the rally points of a given list of entities (carried in cmd.entities). | ||||
* | * | ||||
* The 'cmd' object may carry its own x/z coordinate pair indicating the location where the rally point should | * The 'cmd' object may carry its own x/z coordinate pair indicating the location where the rally point should | ||||
* be rendered, in order to support instantaneously rendering a rally point marker at a specified location | * be rendered, in order to support instantaneously rendering a rally point marker at a specified location | ||||
* instead of incurring a delay while PostNetworkCommand processes the set-rallypoint command (see input.js). | * instead of incurring a delay while PostNetworkCommand processes the set-rallypoint command (see input.js). | ||||
* If cmd doesn't carry a custom location, then the position to render the marker at will be read from the | * If cmd doesn't carry a custom location, then the position to render the marker at will be read from the | ||||
* RallyPoint component. | * RallyPoint component. | ||||
▲ Show 20 Lines • Show All 1,045 Lines • ▼ Show 20 Lines | let exposedFunctions = { | ||||
"GetTimeNotifications": 1, | "GetTimeNotifications": 1, | ||||
"GetAvailableFormations": 1, | "GetAvailableFormations": 1, | ||||
"GetFormationRequirements": 1, | "GetFormationRequirements": 1, | ||||
"CanMoveEntsIntoFormation": 1, | "CanMoveEntsIntoFormation": 1, | ||||
"IsFormationSelected": 1, | "IsFormationSelected": 1, | ||||
"GetFormationInfoFromTemplate": 1, | "GetFormationInfoFromTemplate": 1, | ||||
"IsStanceSelected": 1, | "IsStanceSelected": 1, | ||||
"GetBattalions": 1, | |||||
"UpdateDisplayedPlayerColors": 1, | "UpdateDisplayedPlayerColors": 1, | ||||
"SetSelectionHighlight": 1, | "SetSelectionHighlight": 1, | ||||
"GetAllBuildableEntities": 1, | "GetAllBuildableEntities": 1, | ||||
"SetStatusBars": 1, | "SetStatusBars": 1, | ||||
"GetPlayerEntities": 1, | "GetPlayerEntities": 1, | ||||
"GetNonGaiaEntities": 1, | "GetNonGaiaEntities": 1, | ||||
"DisplayRallyPoint": 1, | "DisplayRallyPoint": 1, | ||||
Show All 39 Lines |
Can't you just pass the members here?