Changeset View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
/** | /** | ||||
* Specifies which template should indicate the target location of a player command, | * Specifies which template should indicate the target location of a player command, | ||||
* given a command type. | * given a command type. | ||||
*/ | */ | ||||
var g_TargetMarker = { | var g_TargetMarker = { | ||||
"move": "special/target_marker" | "move": "special/target_marker", | ||||
// TODO: Add proper marker | |||||
"map_flare": "special/target_marker" | |||||
}; | }; | ||||
/** | /** | ||||
* Which enemy entity types will be attacked on sight when patroling. | * Which enemy entity types will be attacked on sight when patroling. | ||||
*/ | */ | ||||
var g_PatrolTargets = ["Unit"]; | var g_PatrolTargets = ["Unit"]; | ||||
const g_DisabledTags = { "color": "255 140 0" }; | const g_DisabledTags = { "color": "255 140 0" }; | ||||
▲ Show 20 Lines • Show All 1,591 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
Engine.GuiInterfaceCall("AddTargetMarker", { | Engine.GuiInterfaceCall("AddTargetMarker", { | ||||
"template": g_TargetMarker.move, | "template": g_TargetMarker.move, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z | "z": target.z | ||||
}); | }); | ||||
} | } | ||||
function displayFlare(target, playerID) | |||||
elexis: as far as I know we used lowercase (could be corrected above too), but all of the JS GUI should… | |||||
{ | |||||
Engine.GuiInterfaceCall("AddTargetMarker", { | |||||
"template": g_TargetMarker.map_flare, | |||||
"x": target.x, | |||||
"z": target.z | |||||
}); | |||||
g_MiniMapPanel.flare(target, playerID) | |||||
} | |||||
Done Inline ActionsAlternatives include JSInterface_*.cpp, or calling calling C++ code directly via GUIInterface. But calling the minimap object directly doesn't sound too bad. That would be better cleaned if passing a JS object { "position": new Vector2D(x, y), "color": ...", ... } to C++. elexis: Alternatives include `JSInterface_*.cpp`, or calling calling C++ code directly via… | |||||
Done Inline Actions
Yep, that's why. Imarok: > Maybe that's why the "ping" variable is here, to signal that the copying is finished.
Yep… | |||||
function findGatherType(gatherer, supply) | function findGatherType(gatherer, supply) | ||||
{ | { | ||||
Done Inline ActionsShould be minimap.ping_position = target elexis: Should be `minimap.ping_position = target`
The Vector2D <-> JS Value conversion is already… | |||||
if (!gatherer.resourceGatherRates || !supply) | if (!gatherer.resourceGatherRates || !supply) | ||||
return undefined; | return undefined; | ||||
if (gatherer.resourceGatherRates[supply.type.generic + "." + supply.type.specific]) | if (gatherer.resourceGatherRates[supply.type.generic + "." + supply.type.specific]) | ||||
return supply.type.specific; | return supply.type.specific; | ||||
if (gatherer.resourceGatherRates[supply.type.generic]) | if (gatherer.resourceGatherRates[supply.type.generic]) | ||||
return supply.type.generic; | return supply.type.generic; | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |
as far as I know we used lowercase (could be corrected above too), but all of the JS GUI should become OOP anyway