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 @@ -59,7 +59,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_walk", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(null, [ent])) }); return true; @@ -110,7 +110,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_walk", - "entity": selection[0] + "entity": selection.find(ent => getActionInfo("attack-move", null, [ent]).possible) }); return true; @@ -148,7 +148,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_attack", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -194,7 +194,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_attack", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -255,7 +255,10 @@ DrawTargetMarker(target); - Engine.GuiInterfaceCall("PlaySound", { "name": "order_patrol", "entity": selection[0] }); + Engine.GuiInterfaceCall("PlaySound", { + "name": "order_patrol", + "entity": selection.find(ent => getActionInfo("patrol", action.target, [ent])) + }); return true; }, "getActionInfo": function(entState, targetState) @@ -303,7 +306,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_heal", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -369,7 +372,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": action.foundation ? "order_build" : "order_repair", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -449,7 +452,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_gather", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -497,7 +500,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_gather", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -610,7 +613,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_trade", - "entity": selection[0] + "entity": selection.find(ent => this.actionCheck(action.target, [ent])) }); return true; @@ -713,7 +716,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_garrison", - "entity": selection[0] + "entity": selection.find(ent => getActionInfo("garrison", action.target, [ent]).possible) }); return true; @@ -794,7 +797,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_guard", - "entity": selection[0] + "entity": selection.find(ent => getActionInfo("guard", action.target, [ent]).possible) }); return true; @@ -854,7 +857,7 @@ Engine.GuiInterfaceCall("PlaySound", { "name": "order_guard", - "entity": selection[0] + "entity": selection.find(ent => getActionInfo("remove-guard", action.target, [ent]).possible && someGuarding([ent])) }); return true;