prevent assigning players a traveler role in a live session (fixes #13)

This commit is contained in:
Steffen 2020-05-24 22:18:43 +02:00
parent 06a11d7208
commit 505593d1c6
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
2 changed files with 8 additions and 1 deletions

View File

@ -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>

View File

@ -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();