From 0931d4ae4bd0b4ba213ead0613ce28251d3b627c Mon Sep 17 00:00:00 2001 From: Mike Harris Date: Sun, 26 Oct 2025 14:19:16 -0500 Subject: [PATCH] FIX: Revert Spawn Highlight Color for DUOS, TRIOS, QUADS (#2298) ## Description: This PR addresses issue #2297 - Spawn Color Overload in DUOS, TRIOS, and QUADS game modes. This PR reverts the spawn highlight color behavior for these game modes so that the player can identify their teammates more easily in these modes. See below for example fix. The "self" player and their teammate in this DUOS mode game are the same `light blue` color as shown in issue #2297 and their opponent is still the same `brown` color as shown in that issue. However, now the player's teammate has a green spawn highlight color (same as v0.26.7 and earlier) and the players on other teams have a yellow spawn highlight color (same as v0.26.7 and earlier). Duos Teammate ID Resolution The "self" player's spawn highlight color remains a breathing white ring, consistent with other game modes. ## 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: GlacialDrift --- src/client/graphics/layers/TerritoryLayer.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/client/graphics/layers/TerritoryLayer.ts b/src/client/graphics/layers/TerritoryLayer.ts index 945ac3524..c8ba09200 100644 --- a/src/client/graphics/layers/TerritoryLayer.ts +++ b/src/client/graphics/layers/TerritoryLayer.ts @@ -2,7 +2,12 @@ import { PriorityQueue } from "@datastructures-js/priority-queue"; import { Colord } from "colord"; import { Theme } from "../../../core/configuration/Config"; import { EventBus } from "../../../core/EventBus"; -import { Cell, PlayerType, UnitType } from "../../../core/game/Game"; +import { + Cell, + ColoredTeams, + PlayerType, + UnitType, +} from "../../../core/game/Game"; import { euclDistFN, TileRef } from "../../../core/game/GameMap"; import { GameUpdateType } from "../../../core/game/GameUpdates"; import { GameView, PlayerView } from "../../../core/game/GameView"; @@ -170,6 +175,7 @@ export class TerritoryLayer implements Layer { .filter((p) => p.type() === PlayerType.Human); const focusedPlayer = this.game.focusedPlayer(); + const teamColors = Object.values(ColoredTeams); for (const human of humans) { if (human === focusedPlayer) { continue; @@ -191,7 +197,17 @@ export class TerritoryLayer implements Layer { // In Team games, the spawn highlight color becomes that player's team color // Optionally, this could be broken down to teammate or enemy and simplified to green and red, respectively const team = human.team(); - if (team !== null) color = this.theme.teamColor(team); + if (team !== null) { + if (teamColors.includes(team)) { + color = this.theme.teamColor(team); + } else { + if (myPlayer.isFriendly(human)) { + color = this.theme.spawnHighlightTeamColor(); + } else { + color = this.theme.spawnHighlightColor(); + } + } + } } for (const tile of this.game.bfs(