mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:20:45 +00:00
Pulse spawn ring white→team color for self in team games
In team games the local player's spawn breathing ring now pulses white→own team color (matching teammates' rings) instead of white→gold. Gold pulse is unchanged for teamless games (singleplayer/FFA). Self ring stays larger than teammates' via existing self/mate radii.
This commit is contained in:
@@ -150,18 +150,20 @@ export class WebGLFrameBuilder {
|
||||
const spawnTile = p.state.spawnTile;
|
||||
if (spawnTile === undefined) continue;
|
||||
const isSelf = me !== null && p.smallID() === me.smallID();
|
||||
// myPlayer's ring color is overridden in SpawnOverlayPass (animated
|
||||
// white→gold pulse); everyone else uses their territory tint.
|
||||
// myPlayer's ring pulses white→this color in SpawnOverlayPass: gold
|
||||
// when teamless, own territory tint in team games (matches teammates'
|
||||
// rings). Everyone else uses their territory tint directly.
|
||||
const c = p.territoryColor().toRgb();
|
||||
const useGold = isSelf && myTeam === null;
|
||||
centers.push({
|
||||
// spawnTile tracks the player's currently-selected spawn directly —
|
||||
// updates the same tick the player picks a new location (faster than
|
||||
// the nameData centroid which only refreshes every 2 ticks).
|
||||
x: gameView.x(spawnTile),
|
||||
y: gameView.y(spawnTile),
|
||||
r: c.r / 255,
|
||||
g: c.g / 255,
|
||||
b: c.b / 255,
|
||||
r: useGold ? 1 : c.r / 255,
|
||||
g: useGold ? 0.84 : c.g / 255,
|
||||
b: useGold ? 0 : c.b / 255,
|
||||
isSelf,
|
||||
isTeammate:
|
||||
myTeam !== null &&
|
||||
|
||||
@@ -151,11 +151,12 @@ export class SpawnOverlayPass {
|
||||
dataA[i * 4 + 0] = c.x;
|
||||
dataA[i * 4 + 1] = c.y;
|
||||
if (c.isSelf) {
|
||||
// Self ring pulses white (1,1,1) → gold (1,0.84,0) in phase with the
|
||||
// breath so one end of the pulse always contrasts with the terrain.
|
||||
dataA[i * 4 + 2] = 1;
|
||||
dataA[i * 4 + 3] = 1 - 0.16 * breathRadius;
|
||||
dataB[i * 4 + 0] = 1 - breathRadius;
|
||||
// Self ring pulses white (1,1,1) → its center color (gold when
|
||||
// teamless, team color in team games) in phase with the breath so
|
||||
// one end of the pulse always contrasts with the terrain.
|
||||
dataA[i * 4 + 2] = 1 - (1 - c.r) * breathRadius;
|
||||
dataA[i * 4 + 3] = 1 - (1 - c.g) * breathRadius;
|
||||
dataB[i * 4 + 0] = 1 - (1 - c.b) * breathRadius;
|
||||
} else {
|
||||
dataA[i * 4 + 2] = c.r;
|
||||
dataA[i * 4 + 3] = c.g;
|
||||
|
||||
Reference in New Issue
Block a user