From: Carl Worth Date: Mon, 4 May 2020 00:34:23 +0000 (-0700) Subject: Perform broadcasts of deregister and capture events X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=a7f0382f3cf9c849f52389daab113f1dc879a5e6;p=empires-server Perform broadcasts of deregister and capture events Allowing clients to track this state --- 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) {