From f915a1a7f8fc308f6bd9d95df5fd12a973cc7d6a Mon Sep 17 00:00:00 2001 From: Steffen Date: Tue, 1 Dec 2020 22:42:21 +0100 Subject: [PATCH] added fabled to session gamestate object --- src/store/socket.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/store/socket.js b/src/store/socket.js index 009299d..f99f7c4 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -206,13 +206,14 @@ class LiveSession { : {}) })); const { session } = this._store.state; + const { fabled } = this._store.state.players; this.sendEdition(); - this.sendFabled(); this._send("gs", { gamestate: this._gamestate, nomination: session.nomination, votingSpeed: session.votingSpeed, lockedVote: session.lockedVote, + fabled: fabled.map(({ id }) => id), ...(session.nomination ? { votes: session.votes } : {}) }); } @@ -224,13 +225,23 @@ class LiveSession { */ _updateGamestate(data) { if (!this._isSpectator) return; - const { gamestate, nomination, votingSpeed, votes, lockedVote } = data; + const { + gamestate, + nomination, + votingSpeed, + votes, + lockedVote, + fabled + } = data; this._store.commit("session/nomination", { nomination, votes, votingSpeed, lockedVote }); + this._store.commit("players/setFabled", { + fabled: fabled.map(id => this._store.state.fabled.get(id)) + }); const players = this._store.state.players.players; // adjust number of players if (players.length < gamestate.length) {