From 06cc01668beb6e6c56473339a7491bb94ab48a27 Mon Sep 17 00:00:00 2001 From: unne27 <59091348+unne27@users.noreply.github.com> Date: Wed, 24 Jun 2026 02:17:57 +0200 Subject: [PATCH] Fix non-structures being deleteable (#4385) Resolves #4307 ## Description: Adds a check for the "delete" element of the raidial menu, to make sure the unit attemped to be removed is a structure. Previously, non-structure units such as trains could be deleted using the menu. ## Please complete the following: - [ ] I have added screenshots for all UI updates (No UI updates) - [ ] I process any text displayed to the user through translateText() and I've added it to the en.json file (No text added) - [ ] I have added relevant tests to the test directory (Not sure how this works or if it's needed) ## Please put your Discord username so you can be contacted if a bug or regression is found: unne27 --------- Co-authored-by: unne27 --- src/client/hud/layers/RadialMenuElements.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/hud/layers/RadialMenuElements.ts b/src/client/hud/layers/RadialMenuElements.ts index c27ff668d..1d10654b4 100644 --- a/src/client/hud/layers/RadialMenuElements.ts +++ b/src/client/hud/layers/RadialMenuElements.ts @@ -528,6 +528,7 @@ export const deleteUnitElement: MenuElement = { (unit) => !unit.isUnderConstruction() && unit.markedForDeletion() === false && + Structures.has(unit.type()) && params.game.manhattanDist(unit.tile(), params.tile) <= DELETE_SELECTION_RADIUS, ); @@ -552,8 +553,11 @@ export const deleteUnitElement: MenuElement = { .units() .filter( (unit) => + !unit.isUnderConstruction() && + unit.markedForDeletion() === false && + Structures.has(unit.type()) && params.game.manhattanDist(unit.tile(), params.tile) <= - DELETE_SELECTION_RADIUS, + DELETE_SELECTION_RADIUS, ); const closestUnit = findClosestBy(myUnits, (unit) =>