Flash alliance icon when renewal prompt is active

When an alliance is within the renewal-prompt window, the alliance
icon above the player's name now pulses, ramping from 2 Hz to 5 Hz
as expiry approaches (same effect as the traitor flash).

The flash window is driven by allianceExtensionPromptOffset() — the
same Config value that triggers the "renew alliance" prompt in the
actionable events display — so the two always stay in sync.

The shader only knew the alliance fraction, not absolute time, so
computePlayerStatus now also emits allianceRemainingTicks, packed
into the free pd7.w slot of the player-data texture.
This commit is contained in:
evanpelle
2026-06-11 14:41:46 -07:00
parent 95d5a0439b
commit 2d747d0f8b
8 changed files with 69 additions and 5 deletions
@@ -333,4 +333,30 @@ describe("computePlayerStatus — live mode (localPlayerSmallID set)", () => {
expect(status.get(2)?.allianceReq).toBe(false);
expect(status.get(2)?.allianceFraction).toBe(0);
});
it("allianceFraction and allianceRemainingTicks come from the alliance expiry", () => {
const players = playersMap(
ps({ smallID: 1, allies: [2] }),
ps({
smallID: 2,
alliances: [
{
id: 1,
other: "me",
createdAt: 100,
expiresAt: 700,
hasExtensionRequest: false,
},
],
}),
);
const status = computePlayerStatus(players, unitsMap(), {
localPlayerSmallID: 1,
localPlayerID: "me",
tick: 400,
allianceDuration: 600,
});
expect(status.get(2)?.allianceFraction).toBe(0.5);
expect(status.get(2)?.allianceRemainingTicks).toBe(300);
});
});