The dice roll once

Rejoining a room replays the whole chronicle through the same events
channel that carries live play, so the opening roll-off modal fired
on every return. The replayed chronicle is now flagged, and one-time
fanfare stays quiet on it — the log still rebuilds in full.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-08-16 22:15:12 -04:00
co-authored by Claude Fable 5
parent ef5336caa8
commit 4a4e164e88
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -319,9 +319,11 @@ wss.on("connection", (socket) => {
session.roomId = room.id; session.roomId = room.id;
session.token = result.token; session.token = result.token;
send(socket, { type: "seat", playerId: name, token: result.token }); send(socket, { type: "seat", playerId: name, token: result.token });
// Rejoining a running game: replay the chronicle so far. // Rejoining a running game: replay the chronicle so far. The
// replayed flag keeps one-time fanfare (the opening roll-off)
// from firing again on every return to the room.
if (room.state) { if (room.state) {
send(socket, { type: "events", events: redactFor(room.events, name) }); send(socket, { type: "events", events: redactFor(room.events, name), replayed: true });
} }
broadcastRoomState(room); broadcastRoomState(room);
runBots(room); runBots(room);
+1 -1
View File
@@ -334,7 +334,7 @@ class Net {
let talk = 0; let talk = 0;
for (const e of msg.events as GameEvent[]) { for (const e of msg.events as GameEvent[]) {
if (e.type === "tableTalk") talk++; if (e.type === "tableTalk") talk++;
if (e.type === "gameStarted") { if (e.type === "gameStarted" && !msg.replayed) {
this.openingRolls = { rolls: e.dieRolls, first: e.firstPlayer, players: e.players }; this.openingRolls = { rolls: e.dieRolls, first: e.firstPlayer, players: e.players };
} }
const line = humanize(e); const line = humanize(e);