Index: binaries/data/mods/public/gui/session/unit_actions.js =================================================================== --- binaries/data/mods/public/gui/session/unit_actions.js +++ binaries/data/mods/public/gui/session/unit_actions.js @@ -359,8 +359,7 @@ }, "getActionInfo": function(entState, targetState) { - if (!entState.builder || - !targetState.needsRepair && !targetState.foundation || + if (!entState.builder || targetState.foundation || !playerCheck(entState, targetState, ["Player", "Ally"])) return false; @@ -409,7 +408,76 @@ }, "specificness": 11, }, + "build": + { + "execute": function(target, action, selection, queued) + { + Engine.PostNetworkCommand({ + "type": "repair", + "entities": selection, + "target": action.target, + "autocontinue": true, + "queued": queued + }); + + Engine.GuiInterfaceCall("PlaySound", { + "name": "order_build", + "entity": selection[0] + }); + + return true; + }, + "getActionInfo": function(entState, targetState) + { + if (!entState.builder || !targetState.foundation || + !playerCheck(entState, targetState, ["Player", "Ally"])) + return false; + + return { "possible": true }; + }, + "preSelectedActionCheck": function(target, selection) + { + if (preSelectedAction != ACTION_REPAIR) + return false; + + if (getActionInfo("build", target, selection).possible) + return { + "type": "build", + "cursor": "action-repair", + "target": target + }; + + return { + "type": "none", + "cursor": "action-repair-disabled", + "target": null + }; + }, + "hotkeyActionCheck": function(target, selection) + { + if (!Engine.HotkeyIsPressed("session.repair") || + !getActionInfo("build", target, selection).possible) + return false; + + return { + "type": "build", + "cursor": "action-repair", + "target": target + }; + }, + "actionCheck": function(target, selection) + { + if (!getActionInfo("build", target, selection).possible) + return false; + return { + "type": "build", + "cursor": "action-repair", + "target": target + }; + }, + "specificness": 11, + }, "gather": { "execute": function(target, action, selection, queued)