Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the hotkey to kill all your units #6463

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/snippets/other.6463.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 0 additions & 4 deletions lua/keymap/keyactions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 1 addition & 6 deletions lua/selfdestruct.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down
12 changes: 4 additions & 8 deletions lua/ui/game/confirmunitdestroy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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('<LOC confirm_0001>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
Loading