Close CPU tables as soon as every human player leaves

- When the last human presses leave on a CPU table (even mid-hand), the table
  is deleted right away instead of lingering with CPUs only; friends / cash-only
  tables keep the existing 30-minute idle cleanup
- Spectators still watching get a "テーブルが終了しました" notice, and the lobby
  updates immediately
- Don't show the "接続が切れました" banner when the page disconnects on purpose
  (closed or missing table)
- Test for the close condition; README notes the behavior

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
agomizi1cmandClaude Opus 5.5 committed 2026-10-17 17:03:58 +09:00
1 parent 0d3a054f0d
commit 02c8e76237
6 files changed
+63 -6

No files matched your search

+5
View File
@@ -152,6 +152,11 @@ class Table {
return true;
}
// CPU戦で人間が全員退席したら、テーブルを残しておく意味がない
shouldClose() {
return this.mode === 'cpu' && !this.seats.some((s) => s && !s.left && !s.bot);
}
removeLeftSeats() {
this.seats = this.seats.map((s) => (s && s.left ? null : s));
}