From 64e8733132406eeee5589449dfbd422e54c916f8 Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Sat, 1 Nov 2025 18:48:40 +0100 Subject: [PATCH] Delete unit: 5s > 15s cooldown and new location in Radial Menu (#2345) ## Description: - Move the Delete button to where the Boat button is otherwise. The Boat and Delete button already mutually exclude eachother anyway; boat button is only visible on other's tiles, delete button is only visible on your own tiles. Evan agreed to this new position: https://discord.com/channels/1359946986937258015/1381293863712591872/1429147325049077860 - Increase the cooldown between deletions from 5 to 15 seconds. PR #2216 introduced a destruction time (deletionMarkDuration) making it take 15s to delete a building. With the cooldown of 15s between clicking the Delete button (deleteUnitCooldown) on top of that, you can actually only delete a building every 15 seconds while it also takes that same time to destruct it. Players have voiced between 10s to 30s or more so 15s is still a reasonable time, keeping deletion of mistakenly placed buildings still possible, while also keeping a small 'scorched earth' option during an attack but probably only being able to delete 1-2 units in an attack. Evan and Vivacious Box agreed with the mentioned 10-15s cooldown too: https://discord.com/channels/1359946986937258015/1381293863712591872/1429103999088459897 **Video: Delete button new location and 15s cooldown:** https://github.com/user-attachments/assets/b0b13fc1-1e50-4a7a-8f32-55f7891f9945 **Delete button new location disabled:** Delete button disabled new location
radial menu **Delete button new location enabled:** Delete button enabled new location
radial menu **Radial menu unchanged on others' tiles:** Radial menu unchanged on other
territory ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33 --------- Co-authored-by: Vivacious Box --- src/client/graphics/layers/RadialMenuElements.ts | 12 +++--------- src/core/configuration/DefaultConfig.ts | 2 +- tests/DeleteUnitExecution.test.ts | 2 ++ tests/client/graphics/RadialMenuElements.test.ts | 12 +++++++----- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/client/graphics/layers/RadialMenuElements.ts b/src/client/graphics/layers/RadialMenuElements.ts index ae4c29d9d..29e5bd379 100644 --- a/src/client/graphics/layers/RadialMenuElements.ts +++ b/src/client/graphics/layers/RadialMenuElements.ts @@ -583,17 +583,11 @@ export const rootMenuElement: MenuElement = { const menuItems: (MenuElement | null)[] = [ infoMenuElement, - boatMenuElement, - ally, + ...(isOwnTerritory + ? [deleteUnitElement, ally, buildMenuElement] + : [boatMenuElement, ally, attackMenuElement]), ]; - if (isOwnTerritory) { - menuItems.push(buildMenuElement); - menuItems.push(deleteUnitElement); - } else { - menuItems.push(attackMenuElement); - } - return menuItems.filter((item): item is MenuElement => item !== null); }, }; diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 3632e4f60..748aa2d62 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -586,7 +586,7 @@ export class DefaultConfig implements Config { return 15 * 10; } deleteUnitCooldown(): Tick { - return 5 * 10; + return 15 * 10; } emojiMessageDuration(): Tick { return 5 * 10; diff --git a/tests/DeleteUnitExecution.test.ts b/tests/DeleteUnitExecution.test.ts index a931c140b..04034a82f 100644 --- a/tests/DeleteUnitExecution.test.ts +++ b/tests/DeleteUnitExecution.test.ts @@ -53,6 +53,8 @@ describe("DeleteUnitExecution Security Tests", () => { game.executeNextTick(); } + executeTicks(game, game.config().deleteUnitCooldown() + 1); + player = game.player(player1Info.id); enemyPlayer = game.player(player2Info.id); diff --git a/tests/client/graphics/RadialMenuElements.test.ts b/tests/client/graphics/RadialMenuElements.test.ts index df8c796d4..67021fee9 100644 --- a/tests/client/graphics/RadialMenuElements.test.ts +++ b/tests/client/graphics/RadialMenuElements.test.ts @@ -299,16 +299,18 @@ describe("RadialMenuElements", () => { expect(rootMenuElement.disabled(mockParams)).toBe(false); }); - it("should show build menu on own territory", () => { + it("should show build and delete menu on own territory", () => { const subMenu = rootMenuElement.subMenu!(mockParams); const buildMenu = subMenu.find((item) => item.id === Slot.Build); const attackMenu = subMenu.find((item) => item.id === Slot.Attack); + const deleteMenu = subMenu.find((item) => item.id === Slot.Delete); expect(buildMenu).toBeDefined(); expect(attackMenu).toBeUndefined(); + expect(deleteMenu).toBeDefined(); }); - it("should show attack menu on enemy territory", () => { + it("should show attack and boat menu on enemy territory", () => { const enemyPlayer = { id: () => 2, isPlayer: jest.fn(() => true), @@ -318,18 +320,18 @@ describe("RadialMenuElements", () => { const subMenu = rootMenuElement.subMenu!(mockParams); const buildMenu = subMenu.find((item) => item.id === Slot.Build); const attackMenu = subMenu.find((item) => item.id === Slot.Attack); + const boatMenu = subMenu.find((item) => item.id === Slot.Boat); expect(attackMenu).toBeDefined(); expect(buildMenu).toBeUndefined(); + expect(boatMenu).toBeDefined(); }); - it("should include info and boat menus in both cases", () => { + it("should include info menu in both cases", () => { const subMenu = rootMenuElement.subMenu!(mockParams); const infoMenu = subMenu.find((item) => item.id === Slot.Info); - const boatMenu = subMenu.find((item) => item.id === Slot.Boat); expect(infoMenu).toBeDefined(); - expect(boatMenu).toBeDefined(); }); it("should handle ally menu correctly", () => {