cleaning up methods added for sending and receiveing changed pronouns in sockets.js

This commit is contained in:
Dave 2021-03-02 19:16:46 +00:00
parent 77e89f290b
commit 992841a45b
1 changed files with 14 additions and 14 deletions

View File

@ -495,7 +495,7 @@ class LiveSession {
if (this._isSpectator && this._store.state.session.playerId !== player.id)
return;
const index = this._store.state.players.players.indexOf(player);
this._send("pronouns", { index, value, fromST: !this._isSpectator });
this._send("pronouns", [index, value, !this._isSpectator]);
}
/**
@ -505,20 +505,20 @@ class LiveSession {
* @param fromSt
* @private
*/
_updatePlayerPronouns({ index, value, fromST }) {
_updatePlayerPronouns([index, value, fromST]) {
const player = this._store.state.players.players[index];
if (
!player ||
(!fromST && this._store.state.session.playerId === player.id) ||
player.pronouns === value
)
return;
player &&
(fromST || this._store.state.session.playerId !== player.id) &&
player.pronouns !== value
) {
this._store.commit("players/update", {
player,
property: "pronouns",
value
});
}
}
/**
* Handle a ping message by another player / storyteller
@ -851,9 +851,9 @@ export default store => {
case "players/update":
if (payload.property === "pronouns") {
session.sendPlayerPronouns(payload);
break;
}
} else {
session.sendPlayer(payload);
}
break;
}
});