Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GuiInterface.js
Show First 20 Lines • Show All 590 Lines • ▼ Show 20 Lines | ret.loot = { | ||||
"stone": resources.stone, | "stone": resources.stone, | ||||
"metal": resources.metal | "metal": resources.metal | ||||
}; | }; | ||||
} | } | ||||
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.GetBaseSpeed(), | ||||
"run": cmpUnitMotion.GetRunSpeed() | "run": cmpUnitMotion.GetBaseSpeed() * cmpUnitMotion.GetTopSpeedRatio(), | ||||
"current": cmpUnitMotion.GetSpeed(), | |||||
"tryingToMove" : cmpUnitMotion.IsTryingToMove() | |||||
}; | }; | ||||
return ret; | return ret; | ||||
}; | }; | ||||
GuiInterface.prototype.GetAverageRangeForBuildings = function(player, cmd) | GuiInterface.prototype.GetAverageRangeForBuildings = function(player, cmd) | ||||
{ | { | ||||
let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); | let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); | ||||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | return { | ||||
"name": template.Formation.FormationName, | "name": template.Formation.FormationName, | ||||
"tooltip": template.Formation.DisabledTooltip || "", | "tooltip": template.Formation.DisabledTooltip || "", | ||||
"icon": template.Formation.Icon | "icon": template.Formation.Icon | ||||
}; | }; | ||||
}; | }; | ||||
GuiInterface.prototype.IsFormationSelected = function(player, data) | GuiInterface.prototype.IsFormationSelected = function(player, data) | ||||
{ | { | ||||
for each (let ent in data.ents) | return QueryPlayerIDInterface(player).GetChosenFormation() === data.formationTemplate; | ||||
{ | |||||
let cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | |||||
// GetLastFormationName is named in a strange way as it (also) is | |||||
// the value of the current formation (see Formation.js LoadFormation) | |||||
if (cmpUnitAI && cmpUnitAI.GetLastFormationTemplate() == data.formationTemplate) | |||||
return true; | |||||
} | |||||
return false; | |||||
}; | }; | ||||
GuiInterface.prototype.IsStanceSelected = function(player, data) | GuiInterface.prototype.IsStanceSelected = function(player, data) | ||||
{ | { | ||||
for each (let ent in data.ents) | for each (let ent in data.ents) | ||||
{ | { | ||||
let cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | ||||
if (cmpUnitAI && cmpUnitAI.GetStanceName() == data.stance) | if (cmpUnitAI && cmpUnitAI.GetStanceName() == data.stance) | ||||
▲ Show 20 Lines • Show All 1,183 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator