Specifically, we fix things here to clear some internal state that was
previously being missed (the "characters_to_reveal" field) and we also
fix things to report to the clients the new game state and the emptty
list of players.
this.broadcast_event("player-leave", `{"id": ${id}}`);
}
- remove_all_players() {
+ reset() {
this._players = [];
+ this.characters_to_reveal = null;
this.next_player_id = 1;
+
+ this.change_state(GameState.JOIN);
+
+ this.broadcast_event("players", "{}");
}
reveal_next() {
});
app.post('/reset', (request, response) => {
- game.remove_all_players();
+ game.reset();
response.send();
});