From a7f0382f3cf9c849f52389daab113f1dc879a5e6 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 3 May 2020 17:34:23 -0700 Subject: [PATCH] Perform broadcasts of deregister and capture events Allowing clients to track this state --- server.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.js b/server.js index bbc5d8a..d08011c 100644 --- a/server.js +++ b/server.js @@ -31,6 +31,8 @@ class Game { remove_player(id) { const index = this._players.findIndex(player => player.id === id); this._players.splice(index, 1); + + this.broadcast("player-deregister", `{"id": ${id}}`); } remove_all_players() { @@ -44,6 +46,8 @@ class Game { * the API specification which we want here. */ let captor = this._players.find(player => player.id === captor_id); captor.captures.push(captee_id); + + this.broadcast("capture", `{"captor": ${captor_id}, "captee": ${captee_id}}`); } liberate(captee_id) { -- 2.43.0