From 52355c5f1951df62885a3ed6ddaf72c5db96babe Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 2 Jun 2026 19:27:11 +0200 Subject: [PATCH 1/6] Add moderation exception to self destruct --- lua/SimCallbacks.lua | 25 ++++++++++++++++++++++++- lua/selfdestruct.lua | 6 +++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lua/SimCallbacks.lua b/lua/SimCallbacks.lua index 63d984c647c..b3d3fd51fb9 100644 --- a/lua/SimCallbacks.lua +++ b/lua/SimCallbacks.lua @@ -179,7 +179,30 @@ Callbacks.UpdateMarker = SimPing.UpdateMarker Callbacks.FactionSelection = ScenarioFramework.OnFactionSelect -Callbacks.ToggleSelfDestruct = import("/lua/selfdestruct.lua").ToggleSelfDestruct +---@param data ToggleSelfDestructData +---@param units Unit[] +Callbacks.ToggleSelfDestruct = function(data, units) + -- prevent malformed input + if (not units) or (table.getn(units) == 0) then + return + end + + -- prevent abuse + if (not data.owner) or (not OkayToMessWithArmy(data.owner)) then + return + end + + -- moderation rule: if you self destruct with one or more ACUs in the selection, then you only self destruct the ACUs + local commandUnits = EntityCategoryFilterDown(categories.COMMAND, SecureUnits(units)) + if (table.getn(commandUnits) > 0) then + import("/lua/selfdestruct.lua").ToggleSelfDestruct(data, commandUnits) + return + end + + -- otherwise just pass it through as usual + import("/lua/selfdestruct.lua").ToggleSelfDestruct(data, units) +end + Callbacks.MarkerOnScreen = import("/lua/simcameramarkers.lua").MarkerOnScreen diff --git a/lua/selfdestruct.lua b/lua/selfdestruct.lua index e7681efcb2a..a2bd2297323 100644 --- a/lua/selfdestruct.lua +++ b/lua/selfdestruct.lua @@ -5,6 +5,10 @@ local CancelCountdown = CancelCountdown local ForkThread = ForkThread local KillThread = KillThread +---@class ToggleSelfDestructData +---@field owner number +---@field noDelay boolean + -- prevent magic numbers local countdownDuration = 5 @@ -20,7 +24,7 @@ local function SelfDestructThread(unit) end --- Toggles the destruction of the units ----@param data { owner: number, noDelay: boolean } +---@param data ToggleSelfDestructData ---@param units? Unit[] function ToggleSelfDestruct(data, units) From 469057a3369aae716c6afd9071224c0d82aed18f Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 2 Jun 2026 19:30:17 +0200 Subject: [PATCH 2/6] Add guard to check for full share --- lua/SimCallbacks.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lua/SimCallbacks.lua b/lua/SimCallbacks.lua index b3d3fd51fb9..be1e4369800 100644 --- a/lua/SimCallbacks.lua +++ b/lua/SimCallbacks.lua @@ -192,11 +192,15 @@ Callbacks.ToggleSelfDestruct = function(data, units) return end - -- moderation rule: if you self destruct with one or more ACUs in the selection, then you only self destruct the ACUs - local commandUnits = EntityCategoryFilterDown(categories.COMMAND, SecureUnits(units)) - if (table.getn(commandUnits) > 0) then - import("/lua/selfdestruct.lua").ToggleSelfDestruct(data, commandUnits) - return + -- moderation rule: if you self destruct with one or more ACUs in the selection when playing full + -- share, then you only self destruct the ACUs. This does not make it impossible to abuse, but it + -- does introduce a simple guardrail. + if ScenarioInfo.Options.Share == "FullShare" then + local commandUnits = EntityCategoryFilterDown(categories.COMMAND, SecureUnits(units)) + if table.getn(commandUnits) > 0 then + import("/lua/selfdestruct.lua").ToggleSelfDestruct(data, commandUnits) + return + end end -- otherwise just pass it through as usual From b2c0fa4b644ca94c34407406a287996fadfd42a1 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 2 Jun 2026 20:56:13 +0200 Subject: [PATCH 3/6] Add guard --- lua/SimCallbacks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/SimCallbacks.lua b/lua/SimCallbacks.lua index be1e4369800..34169119f5c 100644 --- a/lua/SimCallbacks.lua +++ b/lua/SimCallbacks.lua @@ -188,7 +188,7 @@ Callbacks.ToggleSelfDestruct = function(data, units) end -- prevent abuse - if (not data.owner) or (not OkayToMessWithArmy(data.owner)) then + if (not data) or (not data.owner) or (not OkayToMessWithArmy(data.owner)) then return end From 810650af50b7c1d5a36610946cba5aefa5d6b214 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 2 Jun 2026 20:58:39 +0200 Subject: [PATCH 4/6] Add changelog snippet --- changelog/snippets/feature.7132.md | 3 +++ changelog/snippets/sections/graphics.7095.md | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/snippets/feature.7132.md delete mode 100644 changelog/snippets/sections/graphics.7095.md diff --git a/changelog/snippets/feature.7132.md b/changelog/snippets/feature.7132.md new file mode 100644 index 00000000000..1cd04e7672a --- /dev/null +++ b/changelog/snippets/feature.7132.md @@ -0,0 +1,3 @@ +- (#7132) Gorton's birthday present + +When playing full share, when you self destruct a selection with one or more ACUs in it you will self destruct only the ACUs instead. diff --git a/changelog/snippets/sections/graphics.7095.md b/changelog/snippets/sections/graphics.7095.md deleted file mode 100644 index eef11c7bb0a..00000000000 --- a/changelog/snippets/sections/graphics.7095.md +++ /dev/null @@ -1 +0,0 @@ -- (#7095) Fix the icon of the Aeon T1 power generator. \ No newline at end of file From 1625d08ab16643831f79033d39dd6bd4be0377e9 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 2 Jun 2026 20:58:48 +0200 Subject: [PATCH 5/6] Move existing changelog snippet into the snippets folder --- changelog/snippets/graphics.7095.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/snippets/graphics.7095.md diff --git a/changelog/snippets/graphics.7095.md b/changelog/snippets/graphics.7095.md new file mode 100644 index 00000000000..eef11c7bb0a --- /dev/null +++ b/changelog/snippets/graphics.7095.md @@ -0,0 +1 @@ +- (#7095) Fix the icon of the Aeon T1 power generator. \ No newline at end of file From 521e09eea799d4fd8eca587bc5ef6e3174bbfc37 Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Tue, 2 Jun 2026 21:00:16 +0200 Subject: [PATCH 6/6] Rename snippet --- changelog/snippets/{feature.7132.md => features.7132.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog/snippets/{feature.7132.md => features.7132.md} (100%) diff --git a/changelog/snippets/feature.7132.md b/changelog/snippets/features.7132.md similarity index 100% rename from changelog/snippets/feature.7132.md rename to changelog/snippets/features.7132.md