Index: ps/trunk/binaries/data/mods/public/gui/session/input.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/input.js +++ ps/trunk/binaries/data/mods/public/gui/session/input.js @@ -213,16 +213,16 @@ // decide between the following ordered actions // if two actions are possible, the first one is taken // so the most specific should appear first - var actions = Object.keys(unitActions).slice(); - actions.sort((a, b) => unitActions[a].specificness - unitActions[b].specificness); + var actions = Object.keys(g_UnitActions).slice(); + actions.sort((a, b) => g_UnitActions[a].specificness - g_UnitActions[b].specificness); var actionInfo = undefined; if (preSelectedAction != ACTION_NONE) { for (var action of actions) - if (unitActions[action].preSelectedActionCheck) + if (g_UnitActions[action].preSelectedActionCheck) { - var r = unitActions[action].preSelectedActionCheck(target, selection); + var r = g_UnitActions[action].preSelectedActionCheck(target, selection); if (r) return r; } @@ -231,17 +231,17 @@ } for (var action of actions) - if (unitActions[action].hotkeyActionCheck) + if (g_UnitActions[action].hotkeyActionCheck) { - var r = unitActions[action].hotkeyActionCheck(target, selection); + var r = g_UnitActions[action].hotkeyActionCheck(target, selection); if (r) return r; } for (var action of actions) - if (unitActions[action].actionCheck) + if (g_UnitActions[action].actionCheck) { - var r = unitActions[action].actionCheck(target, selection); + var r = g_UnitActions[action].actionCheck(target, selection); if (r) return r; } @@ -1073,7 +1073,7 @@ var queued = Engine.HotkeyIsPressed("session.queue"); var target = Engine.GetTerrainAtScreenPoint(ev.x, ev.y); - if (unitActions[action.type] && unitActions[action.type].execute) + if (g_UnitActions[action.type] && g_UnitActions[action.type].execute) { let selection = g_Selection.toList(); if (orderone) @@ -1081,8 +1081,8 @@ // pick the first unit that can do this order. let unit = selection.find(entity => ["preSelectedActionCheck", "hotkeyActionCheck", "actionCheck"].some(method => - unitActions[action.type][method] && - unitActions[action.type][method](action.target || undefined, [entity]) + g_UnitActions[action.type][method] && + g_UnitActions[action.type][method](action.target || undefined, [entity]) )); if (unit) { @@ -1090,7 +1090,7 @@ g_Selection.removeList(selection); } } - return unitActions[action.type].execute(target, action, selection, queued); + return g_UnitActions[action.type].execute(target, action, selection, queued); } error("Invalid action.type " + action.type); @@ -1113,8 +1113,8 @@ var selection = g_Selection.toList(); var queued = Engine.HotkeyIsPressed("session.queue"); - if (unitActions[action.type] && unitActions[action.type].execute) - return unitActions[action.type].execute(target, action, selection, queued); + if (g_UnitActions[action.type] && g_UnitActions[action.type].execute) + return g_UnitActions[action.type].execute(target, action, selection, queued); error("Invalid action.type " + action.type); return false; } Index: ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js +++ ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js @@ -39,7 +39,7 @@ * The lower the number, the more specific an action is, and the bigger * the chance of selecting that action when multiple actions are possible */ -var unitActions = +var g_UnitActions = { "move": { @@ -1515,9 +1515,9 @@ if (!entState) continue; - if (unitActions[action] && unitActions[action].getActionInfo) + if (g_UnitActions[action] && g_UnitActions[action].getActionInfo) { - let r = unitActions[action].getActionInfo(entState, targetState, simState); + let r = g_UnitActions[action].getActionInfo(entState, targetState, simState); if (r && r.possible) // return true if it's possible for one of the entities return r; }