Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(play): fix fighters seated before the war room's faction mints land wearing the wrong colour

nirholas97818bdd52ee
diff --git a/src/play/war-world.js b/src/play/war-world.js
index 18b970822..175f77d8b 100644
--- a/src/play/war-world.js
+++ b/src/play/war-world.js
@@ -181,7 +181,14 @@ export class WarWorld {
// arrives. Called with the mints so the caller does not have to know the
// palette.
setFactions({ a, b }) {
+ if (a === this.factions.a && b === this.factions.b) return;
this.factions = { a: a || '', b: b || '' };
+ // Fighters can be seated before the room state that names the two
+ // communities lands, so re-colour anyone already on the field rather than
+ // leaving a whole side wearing the wrong colour for the rest of the battle.
+ for (const [, f] of this.fighters) {
+ if (f?.disc) f.disc.material.color.setHex(this.factionColor(f.faction));
+ }
}
factionColor(mint) {
diff --git a/src/play/war.js b/src/play/war.js
index 9f29c3598..dd97773c6 100644
--- a/src/play/war.js
+++ b/src/play/war.js
@@ -149,6 +149,9 @@ let attackCooldownUntil = 0;
}
localId = room.sessionId;
+ // The two communities are already on the joined state, so colour the arena
+ // before any fighter callback runs rather than after the first patch.
+ world.setFactions({ a: room.state.aMint, b: room.state.bMint });
wireRoom(room);
setStatus(null);
$('hud').hidden = false;