A seated wizard leaves the room's expected list, live and on rebuild
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
1ebd6dbe47
commit
d76a18d5e6
@@ -294,6 +294,8 @@ export function joinRoom(
|
||||
const fresh = randomBytes(16).toString("hex");
|
||||
room.players.push(playerId);
|
||||
room.tokens.set(playerId, hashToken(fresh));
|
||||
// An expected wizard who sits is expected no longer.
|
||||
if (room.expected?.includes(playerId)) room.expected = room.expected.filter((n) => n !== playerId);
|
||||
appendLine(room.id, { kind: "join", name: playerId, tokenHash: hashToken(fresh) });
|
||||
recordRoom(room);
|
||||
return { token: fresh };
|
||||
@@ -816,6 +818,7 @@ function rebuildRoom(id: string, lines: RoomLine[]): Room | null {
|
||||
if (!joinHash) throw new Error("join line has no token");
|
||||
room.players.push(line.name);
|
||||
room.tokens.set(line.name, joinHash);
|
||||
if (room.expected?.includes(line.name)) room.expected = room.expected.filter((n) => n !== line.name);
|
||||
}
|
||||
} else if (line.kind === "start") {
|
||||
const r = startInMemory(room, line.expansion, line.colors, line.deckRev);
|
||||
|
||||
Reference in New Issue
Block a user