Allow mobile players to take part in the aftergame 🙂 (#4615)

## Description:

In team games, after the game is over, players should be able to nuke
their teammates (the core simulation already allows this via
`nukeSpawn()`). On desktop this works because players can use keyboard
shortcuts to select nukes directly. However, on mobile, the radial menu
unconditionally replaces the attack submenu with "donate gold" when
targeting a friendly player, making it impossible to access nukes
targeting teammates in the aftergame.

The fix checks whether any buildable attack units (AtomBomb,
HydrogenBomb, MIRV) are actually available for the target tile. Since
`nukeSpawn()` only returns a valid silo for teammate tiles after game
over, this naturally detects the aftergame state and shows the attack
submenu. During normal gameplay, `nukeSpawn()` blocks teammate nukes so
`hasBuildableAttacks` stays false and donate gold is shown as before.

## 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

## Please put your Discord username so you can be contacted if a bug or
regression is found:

FloPinguin
This commit is contained in:
FloPinguin
2026-07-15 12:16:08 -07:00
committed by GitHub
parent 1a34321ac8
commit ef6e8be2be
+11 -1
View File
@@ -667,6 +667,16 @@ export const rootMenuElement: MenuElement = {
const inExtensionWindow =
params.playerActions.interaction?.allianceInfo?.inExtensionWindow;
// After game-over, nukes can target teammates (nukeSpawn allows it).
// Show the attack submenu so mobile users can access nukes in the aftergame.
const hasBuildableAttacks =
params.playerActions.buildableUnits?.some(
(bu) => BuildableAttacks.has(bu.type) && bu.canBuild !== false,
) ?? false;
const showDonateInsteadOfAttack =
isFriendlyTarget(params) && !isDisconnected && !hasBuildableAttacks;
const menuItems: (MenuElement | null)[] = [
infoMenuElement,
...(isOwnTerritory
@@ -674,7 +684,7 @@ export const rootMenuElement: MenuElement = {
: [
isAllied && !isDisconnected ? allyBreakElement : boatMenuElement,
inExtensionWindow ? allyExtendElement : allyRequestElement,
isFriendlyTarget(params) && !isDisconnected
showDonateInsteadOfAttack
? donateGoldRadialElement
: attackMenuElement,
]),