Index: binaries/data/mods/public/gui/session/input.js =================================================================== --- binaries/data/mods/public/gui/session/input.js +++ binaries/data/mods/public/gui/session/input.js @@ -1258,9 +1258,27 @@ var selection = g_Selection.toList(); + const orderone = Engine.HotkeyIsPressed("session.orderone"); var queued = Engine.HotkeyIsPressed("session.queue"); if (g_UnitActions[action.type] && g_UnitActions[action.type].execute) + { + // Partly duplicated from doAction() + if (orderone) + { + // pick the first unit that can do this order. + const unit = selection + .find(entity => ["preSelectedActionCheck", "hotkeyActionCheck", "actionCheck"] + .some(method => + g_UnitActions[action.type][method] && + g_UnitActions[action.type][method](action.target || undefined, [entity])) + ); + if (unit) { + selection = [unit]; + g_Selection.removeList(selection); + } + } return g_UnitActions[action.type].execute(target, action, selection, queued); + } error("Invalid action.type " + action.type); return false; }