From f7ff71e8d5c00298ef2e0042950f44b53e9c221d Mon Sep 17 00:00:00 2001 From: elexis Date: Tue, 2 Aug 2016 15:42:35 +0000 Subject: [PATCH] Hotkeys to repair, ungarrison and focus on the rallypoint. Patch by Imarok, refs #4008. This was SVN commit r18578. --- binaries/data/config/default.cfg | 3 ++ .../data/mods/public/gui/manual/intro.txt | 2 ++ .../public/gui/session/hotkeys/camera.xml | 4 +++ .../mods/public/gui/session/hotkeys/misc.xml | 4 +++ .../mods/public/gui/session/unit_actions.js | 34 ++++++++++++++++--- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg index 95a44ba787..c44c0b12cd 100644 --- a/binaries/data/config/default.cfg +++ b/binaries/data/config/default.cfg @@ -181,6 +181,7 @@ quickload = "Shift+F8" [hotkey.camera] reset = "R" ; Reset camera rotation to default. follow = "F" ; Follow the first unit in the selection +rallypointfocus = unused ; Focus the camera on the rally point of the selected building zoom.in = Plus, Equals, NumPlus ; Zoom camera in (continuous control) zoom.out = Minus, NumMinus ; Zoom camera out (continuous control) zoom.wheel.in = WheelUp ; Zoom camera in (stepped control) @@ -278,12 +279,14 @@ offscreen = Alt ; Include offscreen units in selection [hotkey.session] kill = Delete ; Destroy selected units stop = "H" ; Stop the current action +unload = "U" ; Unload garrisoned units when a building/mechanical unit is selected attack = Ctrl ; Modifier to attack instead of another action (eg capture) attackmove = Ctrl ; Modifier to attackmove when clicking on a point attackmoveUnit = "Ctrl+Q" ; Modifier to attackmove targeting only units when clicking on a point (should contain the attackmove keys) garrison = Ctrl ; Modifier to garrison when clicking on building autorallypoint = Ctrl ; Modifier to set the rally point on the building itself guard = "G" ; Modifier to escort/guard when clicking on unit/building +repair = "J" ; Modifier to repair when clicking on building/mechanical unit queue = Shift ; Modifier to queue unit orders instead of replacing batchtrain = Shift ; Modifier to train units in batches massbarter = Shift ; Modifier to barter bunch of resources diff --git a/binaries/data/mods/public/gui/manual/intro.txt b/binaries/data/mods/public/gui/manual/intro.txt index 5a9de4e6b1..5d85d80413 100644 --- a/binaries/data/mods/public/gui/manual/intro.txt +++ b/binaries/data/mods/public/gui/manual/intro.txt @@ -70,6 +70,7 @@ Shift + /: add idle fighter to selection . (Period): Select idle worker (including citizen soldiers) Shift + .: add idle worker to selection (including citizen soldiers) H: Stop (halt) the currently selected units. +U: Unload the garrisoned units of the selected buildings Ctrl + 1 (and so on up to Ctrl + 0): Create control group 1 (to 0) from the selected units/buildings 1 (and so on up to 0): Select the units/buildings in control group 1 (to 0) Shift + 1 (to 0): Add control group 1 (to 0) to the selected units/buildings @@ -82,6 +83,7 @@ Tab: See all status bars (which would also show the building progress) [font="sans-bold-14"]Modify mouse action [font="sans-14"]Ctrl + Right Click on building: Garrison +J + Right Click on building: Repair Shift + Right Click: Queue the move/build/gather/etc order Shift + Left click when training unit/s: Add units in batches of five Shift + Left Click or Left Drag over unit on map: Add unit to selection diff --git a/binaries/data/mods/public/gui/session/hotkeys/camera.xml b/binaries/data/mods/public/gui/session/hotkeys/camera.xml index 6a2e435cef..7845843774 100644 --- a/binaries/data/mods/public/gui/session/hotkeys/camera.xml +++ b/binaries/data/mods/public/gui/session/hotkeys/camera.xml @@ -5,6 +5,10 @@ setCameraFollow(g_Selection.getFirstSelected()); + + performCommand(g_Selection.getFirstSelected(), "focus-rally"); + + jumpCamera(1); diff --git a/binaries/data/mods/public/gui/session/hotkeys/misc.xml b/binaries/data/mods/public/gui/session/hotkeys/misc.xml index cdbdc08302..9a8255d866 100644 --- a/binaries/data/mods/public/gui/session/hotkeys/misc.xml +++ b/binaries/data/mods/public/gui/session/hotkeys/misc.xml @@ -46,6 +46,10 @@ performCommand(g_Selection.getFirstSelected(), "delete"); + + unloadAll(); + + stopUnits(g_Selection.toList()); diff --git a/binaries/data/mods/public/gui/session/unit_actions.js b/binaries/data/mods/public/gui/session/unit_actions.js index 32f05fafce..a30a953c97 100644 --- a/binaries/data/mods/public/gui/session/unit_actions.js +++ b/binaries/data/mods/public/gui/session/unit_actions.js @@ -345,6 +345,18 @@ var unitActions = "target": null }; }, + "hotkeyActionCheck": function(target) + { + if (!Engine.HotkeyIsPressed("session.repair") || + !getActionInfo("repair", target).possible) + return false; + + return { + "type": "build", + "cursor": "action-repair", + "target": target + }; + }, "actionCheck": function(target) { if (!getActionInfo("repair", target).possible) @@ -784,7 +796,15 @@ var unitActions = cursor = "action-attack-move"; } - if (targetState.garrisonHolder && + if (Engine.HotkeyIsPressed("session.repair") && + (targetState.needsRepair || targetState.foundation) && + playerCheck(entState, targetState, ["Player", "Ally"])) + { + data.command = "repair"; + data.target = targetState.id; + cursor = "action-repair"; + } + else if (targetState.garrisonHolder && playerCheck(entState, targetState, ["Player", "MutualAlly"])) { data.command = "garrison"; @@ -974,7 +994,8 @@ var g_EntityCommands = } return { - "tooltip": translate("Unload All"), + "tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.unload") + + translate("Unload All."), "icon": "garrison-out.png", "count": count, }; @@ -1089,7 +1110,8 @@ var g_EntityCommands = return false; return { - "tooltip": translate("Repair"), + "tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.repair") + + translate("Order the selected units to repair a building or mechanical unit."), "icon": "repair.png" }; }, @@ -1107,7 +1129,8 @@ var g_EntityCommands = return false; return { - "tooltip": translate("Focus on Rally Point"), + "tooltip": colorizeHotkey("%(hotkey)s" + " ", "camera.rallypointfocus") + + translate("Focus on Rally Point."), "icon": "focus-rally.png" }; }, @@ -1253,7 +1276,8 @@ var g_AllyEntityCommands = } return { - "tooltip": translate("Unload All"), + "tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.unload") + + translate("Unload All."), "icon": "garrison-out.png", "count": count, };