The seat file follows the join, not the ghost
Joining a new room while an old seat file lingered kept the OLD room id beside the NEW room's token — orphaning the fresh seat as an unkickable lobby ghost the moment the file was cleared. A join now records the room it actually joined; only resumes inherit the file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015RCWSTnb1KYTPyL4GmhGnF
This commit is contained in:
co-authored by
Claude Fable 5
parent
86ac86b6bc
commit
063cd2a78c
@@ -101,7 +101,8 @@ ws.on("message", (raw) => {
|
|||||||
const msg = JSON.parse(raw.toString());
|
const msg = JSON.parse(raw.toString());
|
||||||
if (msg.type === "error") die(`SERVER: ${msg.message}`);
|
if (msg.type === "error") die(`SERVER: ${msg.message}`);
|
||||||
if (msg.type === "seat") {
|
if (msg.type === "seat") {
|
||||||
const s = { roomId: seat?.roomId ?? args[0]?.toUpperCase(), name: msg.playerId, token: msg.token };
|
// A join names its room explicitly; only a resume inherits the file's.
|
||||||
|
const s = { roomId: verb === "join" ? args[0].toUpperCase() : seat.roomId, name: msg.playerId, token: msg.token };
|
||||||
writeFileSync(SEAT_FILE, JSON.stringify(s));
|
writeFileSync(SEAT_FILE, JSON.stringify(s));
|
||||||
if (verb === "join") { console.log(`seated as ${msg.playerId} in ${s.roomId}`); afterJoin(); }
|
if (verb === "join") { console.log(`seated as ${msg.playerId} in ${s.roomId}`); afterJoin(); }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user