mirror of https://github.com/bra1n/townsquare.git
prevent assigning players a traveler role in a live session (fixes #13)
This commit is contained in:
parent
06a11d7208
commit
505593d1c6
|
@ -49,7 +49,7 @@ export default {
|
|||
availableRoles.push({});
|
||||
return availableRoles;
|
||||
},
|
||||
...mapState(["modals", "roles"]),
|
||||
...mapState(["modals", "roles", "session"]),
|
||||
...mapState("players", ["players"])
|
||||
},
|
||||
methods: {
|
||||
|
@ -61,6 +61,7 @@ export default {
|
|||
role
|
||||
});
|
||||
} else {
|
||||
if (this.session.isSpectator && role.team === "traveler") return;
|
||||
// assign to player
|
||||
const player = this.$store.state.players.players[this.playerIndex];
|
||||
this.$store.commit("players/update", {
|
||||
|
@ -105,4 +106,8 @@ ul.tokens li {
|
|||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
||||
#townsquare.spectator ul.tokens li.traveler {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -110,6 +110,7 @@ class LiveSession {
|
|||
* @param channel
|
||||
*/
|
||||
connect(channel) {
|
||||
this._store.commit("setPlayerCount", 0);
|
||||
this._isSpectator = this._store.state.session.isSpectator;
|
||||
this._open(channel);
|
||||
}
|
||||
|
@ -118,6 +119,7 @@ class LiveSession {
|
|||
* Close the current session, if any.
|
||||
*/
|
||||
disconnect() {
|
||||
this._store.commit("setPlayerCount", 0);
|
||||
if (this._socket) {
|
||||
this._send("bye", this._playerId);
|
||||
this._socket.close();
|
||||
|
|
Loading…
Reference in New Issue