mirror of https://github.com/bra1n/townsquare.git
cleaning up methods added for sending and receiveing changed pronouns in sockets.js
This commit is contained in:
parent
77e89f290b
commit
992841a45b
|
@ -495,7 +495,7 @@ class LiveSession {
|
||||||
if (this._isSpectator && this._store.state.session.playerId !== player.id)
|
if (this._isSpectator && this._store.state.session.playerId !== player.id)
|
||||||
return;
|
return;
|
||||||
const index = this._store.state.players.players.indexOf(player);
|
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
|
* @param fromSt
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_updatePlayerPronouns({ index, value, fromST }) {
|
_updatePlayerPronouns([index, value, fromST]) {
|
||||||
const player = this._store.state.players.players[index];
|
const player = this._store.state.players.players[index];
|
||||||
if (
|
if (
|
||||||
!player ||
|
player &&
|
||||||
(!fromST && this._store.state.session.playerId === player.id) ||
|
(fromST || this._store.state.session.playerId !== player.id) &&
|
||||||
player.pronouns === value
|
player.pronouns !== value
|
||||||
)
|
) {
|
||||||
return;
|
|
||||||
this._store.commit("players/update", {
|
this._store.commit("players/update", {
|
||||||
player,
|
player,
|
||||||
property: "pronouns",
|
property: "pronouns",
|
||||||
value
|
value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a ping message by another player / storyteller
|
* Handle a ping message by another player / storyteller
|
||||||
|
@ -851,9 +851,9 @@ export default store => {
|
||||||
case "players/update":
|
case "players/update":
|
||||||
if (payload.property === "pronouns") {
|
if (payload.property === "pronouns") {
|
||||||
session.sendPlayerPronouns(payload);
|
session.sendPlayerPronouns(payload);
|
||||||
break;
|
} else {
|
||||||
}
|
|
||||||
session.sendPlayer(payload);
|
session.sendPlayer(payload);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue