Restored rooms wake their automatons

The bot pump only ran when a command or join arrived, so a server
restart landing mid-bot-turn left the restored room waiting forever
for a human to poke it — room 928D sat exactly there, its automaton
holding a perfectly answerable stack. Boot now kicks the pump for
every restored still-running room, two seconds after restore.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-08-17 18:07:33 -04:00
co-authored by Claude Fable 5
parent 2ac046611d
commit 4a75370de5
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -91,6 +91,11 @@ export function roomCount(): number {
return rooms.size;
}
/** Every restored, still-running room — so boot can wake their bot pumps. */
export function runningRooms(): Room[] {
return [...rooms.values()].filter((r) => r.state && r.state.phase === "playing");
}
export function createRoom(hostId: PlayerId): { room: Room; token: string } {
const token = randomBytes(16).toString("hex");
const room: Room = {