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:**
<img width="310" height="316" alt="Delete button disabled new location
radial menu"
src="https://github.com/user-attachments/assets/f65b88ad-5859-4982-be53-8f2f693f5767"
/>

**Delete button new location enabled:**
<img width="332" height="305" alt="Delete button enabled new location
radial menu"
src="https://github.com/user-attachments/assets/037f07c5-622a-4857-9ab8-fc20981de816"
/>

**Radial menu unchanged on others' tiles:**
<img width="346" height="307" alt="Radial menu unchanged on other
territory"
src="https://github.com/user-attachments/assets/085b2043-096f-4c44-8917-467adb8a7213"
/>


## 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 <jon@rouillard.org>
This commit is contained in:
VariableVince
2025-11-01 18:48:40 +01:00
committed by GitHub
parent daf3fee14d
commit 64e8733132
4 changed files with 13 additions and 15 deletions
@@ -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);
},
};
+1 -1
View File
@@ -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;
+2
View File
@@ -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);
@@ -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", () => {