Skip to content

Commit effce3d

Browse files
aConiferDaniel-Mangoclaudeiiamlewis
authored
add teammate pulse highlight during spawn phase in team games (#2768)
Adds a pulsing highlight effect for teammates during the spawn phase in team games. This helps colorblind players identify their teammates on the map more easily. - Teammates show a subtle green/team-colored pulse (5-14px radius) - Player's own pulse remains unchanged (8-24px white pulse) - Only activates during spawn phase in team games - Animation stays synchronized with player's own pulse I didn't want to come empty handed with my request so I generated the code I do know python and a little rust, but don't have TypeScript experience - I know you guys are probably getting flooded with AI slop so I hope its okay. Please implement the feature at the very least because its SO much better not having to hunt around. 🤖 Generated with [Claude Code](https://claude.com/claude-code) So the code calls drawTeammateHighlights() inside of drawFocusedPlayerHighlight() so it can only occur where current highlighting occurs Then uses the existing isOnSameTeam() to find teammates Then uses the existing drawBreathingRing() function - [x] I have added screenshots for all UI updates I took a video since it best captures the feature - [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 I'm not that good at coding formally, I tested it manually by loading into team games, but I'm going to need help with the code being tested. (Please help) - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced I did load into multiple lobbies and made sure the feature works, its a really simple feature so I am confident there isn't any Lovecraftian bug lurking in it. It also uses mostly existing functions and features within the code base. https://github.com/user-attachments/assets/857cce43-4fb2-4c5d-bc04-1a6617570dee Co-authored-by: Daniel <daniel@mangoit.ca> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: iamlewis <lewismmmm@gmail.com>
1 parent e79c805 commit effce3d

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

src/client/graphics/layers/TerritoryLayer.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,62 @@ export class TerritoryLayer implements Layer {
263263
baseColor, // Always draw white static semi-transparent ring
264264
teamColor, // Pass the breathing ring color. White for FFA, Duos, Trios, Quads. Transparent team color for TEAM games.
265265
);
266+
267+
// Draw breathing rings for teammates in team games (helps colorblind players identify teammates)
268+
this.drawTeammateHighlights(minRad, maxRad, radius);
269+
}
270+
271+
private drawTeammateHighlights(
272+
minRad: number,
273+
maxRad: number,
274+
radius: number,
275+
) {
276+
const myPlayer = this.game.myPlayer();
277+
if (myPlayer === null || myPlayer.team() === null) {
278+
return;
279+
}
280+
281+
const teammates = this.game
282+
.playerViews()
283+
.filter((p) => p !== myPlayer && myPlayer.isOnSameTeam(p));
284+
285+
// Smaller radius for teammates (more subtle than self highlight)
286+
const teammateMinRad = 5;
287+
const teammateMaxRad = 14;
288+
const teammateRadius =
289+
teammateMinRad +
290+
(teammateMaxRad - teammateMinRad) *
291+
((radius - minRad) / (maxRad - minRad));
292+
293+
const teamColors = Object.values(ColoredTeams);
294+
for (const teammate of teammates) {
295+
const center = teammate.nameLocation();
296+
if (!center) {
297+
continue;
298+
}
299+
300+
const team = teammate.team();
301+
let baseColor: Colord;
302+
let breathingColor: Colord;
303+
304+
if (team !== null && teamColors.includes(team)) {
305+
baseColor = this.theme.teamColor(team).alpha(0.5);
306+
breathingColor = this.theme.teamColor(team).alpha(0.5);
307+
} else {
308+
baseColor = this.theme.spawnHighlightTeamColor();
309+
breathingColor = this.theme.spawnHighlightTeamColor();
310+
}
311+
312+
this.drawBreathingRing(
313+
center.x,
314+
center.y,
315+
teammateMinRad,
316+
teammateMaxRad,
317+
teammateRadius,
318+
baseColor,
319+
breathingColor,
320+
);
321+
}
266322
}
267323

268324
init() {

0 commit comments

Comments
 (0)