]> git.cworth.org Git - lmno-server/commitdiff
Add some additional server handling of stuck and remaining
authorCarl Worth <cworth@cworth.org>
Fri, 6 Mar 2026 12:27:01 +0000 (07:27 -0500)
committerCarl Worth <cworth@cworth.org>
Fri, 6 Mar 2026 13:21:38 +0000 (08:21 -0500)
Broadcast the clearing of the "stuck" set when dealing, and include
the remaining count when a player joins.

letterrip.js

index 23e682daa98738b2f7b87d80e397e4dbd59a8b27..24b7fd1c0dec20dcf98040e19ed391a3a83d318d 100644 (file)
@@ -77,6 +77,7 @@ class LetterRip extends Game {
     }
 
     this.state.stuck = new Set();
+    this.broadcast_event_object("stuck", { stuck: [] });
     this.broadcast_event_object("dealt", {
       remaining: this.state.bag.length
     });
@@ -95,7 +96,10 @@ class LetterRip extends Game {
 
     /* Don't re-deal if player already has tiles. */
     if (this.state.player_tiles[session_id]) {
-      response.json({ tiles: this.state.player_tiles[session_id] });
+      response.json({
+        tiles: this.state.player_tiles[session_id],
+        remaining: this.state.bag.length
+      });
       return;
     }
 
@@ -114,7 +118,7 @@ class LetterRip extends Game {
       remaining: this.state.bag.length
     });
 
-    response.json({ tiles: tiles });
+    response.json({ tiles: tiles, remaining: this.state.bag.length });
   }
 
   handle_stuck(request, response) {