Skip to content

Commit

Permalink
Remove the hotkey to kill all your units (FAForever#6463)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored and lL1l1 committed Oct 14, 2024
1 parent 7924b5f commit e60a38b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
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

0 comments on commit e60a38b

Please sign in to comment.