From 6f74c0a9a0f3ea41f6aa012cffcfcb002cd16c84 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Mon, 7 Oct 2024 20:14:39 +0200 Subject: [PATCH] Remove the hotkey to kill all your units (#6463) --- changelog/snippets/other.6463.md | 3 +++ lua/keymap/keyactions.lua | 4 ---- lua/selfdestruct.lua | 7 +------ lua/ui/game/confirmunitdestroy.lua | 12 ++++-------- 4 files changed, 8 insertions(+), 18 deletions(-) create mode 100644 changelog/snippets/other.6463.md diff --git a/changelog/snippets/other.6463.md b/changelog/snippets/other.6463.md new file mode 100644 index 0000000000..44d870eaf7 --- /dev/null +++ b/changelog/snippets/other.6463.md @@ -0,0 +1,3 @@ +- (#6463) Remove the 'Kill all your units' hotkey and related functionality + +The existence of the hotkey makes it appear legitimate while it is typically against the rules. diff --git a/lua/keymap/keyactions.lua b/lua/keymap/keyactions.lua index d39faf8ccf..0bb395a03b 100755 --- a/lua/keymap/keyactions.lua +++ b/lua/keymap/keyactions.lua @@ -1587,10 +1587,6 @@ local keyActionsOrders = { action = 'UI_Lua import("/lua/ui/game/confirmunitdestroy.lua").ConfirmUnitDestruction(true)', category = 'orders', }, - ['Kill_All'] = { - action = 'UI_Lua import("/lua/ui/game/confirmunitdestroy.lua").ConfirmUnitDestruction(true, true)', - category = 'orders', - }, ['dock'] = { action = 'UI_Lua import("/lua/ui/game/orders.lua").Dock(true)', category = 'orders', diff --git a/lua/selfdestruct.lua b/lua/selfdestruct.lua index 4e1a7e2880..889c04d870 100644 --- a/lua/selfdestruct.lua +++ b/lua/selfdestruct.lua @@ -20,7 +20,7 @@ local function SelfDestructThread(unit) end --- Toggles the destruction of the units ----@param data { owner: number, noDelay: boolean, allUnits: boolean } +---@param data { owner: number, noDelay: boolean } ---@param units Unit[] function ToggleSelfDestruct(data, units) @@ -32,11 +32,6 @@ function ToggleSelfDestruct(data, units) -- do not allow observers to use this if data.owner ~= -1 and OkayToMessWithArmy(data.owner) then - -- if we want to destroy all units - if data.allUnits then - units = GetArmyBrain(data.owner):GetListOfUnits(categories.ALLUNITS, false, false) - end - -- just take them all out if data.noDelay then for _, unit in units do diff --git a/lua/ui/game/confirmunitdestroy.lua b/lua/ui/game/confirmunitdestroy.lua index ac54c932d4..3238b835ab 100644 --- a/lua/ui/game/confirmunitdestroy.lua +++ b/lua/ui/game/confirmunitdestroy.lua @@ -3,18 +3,14 @@ local CreateAnnouncement = import("/lua/ui/game/announcement.lua").CreateAnnouncement ---@param instant boolean ----@param allUnits boolean -function ConfirmUnitDestruction(instant, allUnits) - local units = GetSelectedUnits() +function ConfirmUnitDestruction(instant) - - if -- do not allow self destructing of command units + if -- do not allow self destructing of command units in campaign import("/lua/ui/campaign/campaignmanager.lua").campaignMode and - not table.empty(EntityCategoryFilterDown(categories.COMMAND, units)) + not table.empty(EntityCategoryFilterDown(categories.COMMAND, GetSelectedUnits())) then CreateAnnouncement('You cannot self destruct during an operation!') else - SimCallback({ Func = 'ToggleSelfDestruct', - Args = { owner = GetFocusArmy(), noDelay = instant, allUnits = allUnits } }, true) + SimCallback({ Func = 'ToggleSelfDestruct', Args = { owner = GetFocusArmy(), noDelay = instant } }, true) end end