]> git.cworth.org Git - lmno-server/blobdiff - empathy.js
empathy: Tell clients how many players have responded
[lmno-server] / empathy.js
index ca93b30f8be5343197a7877c002fa7181cfb2a02..9bc5740d1b9b6fab0bed5d47e3dcb99138bc5676 100644 (file)
@@ -6,7 +6,8 @@ class Empathy extends Game {
     super(id);
     this.state = {
       prompts: [],
-      active_prompt: null
+      active_prompt: null,
+      players_answered: 0
     };
     this.answers = [];
     this.next_prompt_id = 1;
@@ -74,6 +75,11 @@ class Empathy extends Game {
       answers: answers
     });
 
+    /* And notify players how many players have answered. */
+    this.state.players_answered++;
+
+    this.broadcast_event_object('answered', this.state.players_answered);
+
     return { valid: true };
   }
 }