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", | ||||
"map_flare": "special/flare_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,808 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, | |||||
"owner": playerID | |||||
}); | |||||
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 getCommandInfo(command, entStates) | function getCommandInfo(command, entStates) | ||||
Done Inline ActionsShould be minimap.ping_position = target elexis: Should be `minimap.ping_position = target`
The Vector2D <-> JS Value conversion is already… | |||||
{ | { | ||||
return entStates && g_EntityCommands[command] && | return entStates && g_EntityCommands[command] && | ||||
allowedPlayersCheck(entStates, g_EntityCommands[command].allowedPlayers) && | allowedPlayersCheck(entStates, g_EntityCommands[command].allowedPlayers) && | ||||
g_EntityCommands[command].getInfo(entStates); | g_EntityCommands[command].getInfo(entStates); | ||||
} | } | ||||
function getActionInfo(action, target, selection) | function getActionInfo(action, target, selection) | ||||
{ | { | ||||
Show All 33 Lines |
as far as I know we used lowercase (could be corrected above too), but all of the JS GUI should become OOP anyway