getting player pronouns to be synced over sockets layer

This commit is contained in:
Dave 2021-01-18 14:02:03 +00:00
parent 03731bc887
commit 48eab1fa8c
2 changed files with 3 additions and 1 deletions

View File

@ -245,6 +245,7 @@ export default {
prompt("Player preffered pronouns", this.player.pronoun) || prompt("Player preffered pronouns", this.player.pronoun) ||
this.player.pronoun; this.player.pronoun;
this.updatePlayer("pronoun", pronoun, true); this.updatePlayer("pronoun", pronoun, true);
this.$emit("trigger", ["updatePlayer", this.player, "pronoun", pronoun]);
}, },
toggleStatus() { toggleStatus() {
if (this.grimoire.isPublic) { if (this.grimoire.isPublic) {

View File

@ -222,6 +222,7 @@ class LiveSession {
id: player.id, id: player.id,
isDead: player.isDead, isDead: player.isDead,
isVoteless: player.isVoteless, isVoteless: player.isVoteless,
pronoun: player.pronoun,
...(player.role && player.role.team === "traveler" ...(player.role && player.role.team === "traveler"
? { roleId: player.role.id } ? { roleId: player.role.id }
: {}) : {})
@ -279,7 +280,7 @@ class LiveSession {
const player = players[x]; const player = players[x];
const { roleId } = state; const { roleId } = state;
// update relevant properties // update relevant properties
["name", "id", "isDead", "isVoteless"].forEach(property => { ["name", "id", "isDead", "isVoteless", "pronoun"].forEach(property => {
const value = state[property]; const value = state[property];
if (player[property] !== value) { if (player[property] !== value) {
this._store.commit("players/update", { player, property, value }); this._store.commit("players/update", { player, property, value });