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({});
|
availableRoles.push({});
|
||||||
return availableRoles;
|
return availableRoles;
|
||||||
},
|
},
|
||||||
...mapState(["modals", "roles"]),
|
...mapState(["modals", "roles", "session"]),
|
||||||
...mapState("players", ["players"])
|
...mapState("players", ["players"])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -61,6 +61,7 @@ export default {
|
||||||
role
|
role
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
if (this.session.isSpectator && role.team === "traveler") return;
|
||||||
// assign to player
|
// assign to player
|
||||||
const player = this.$store.state.players.players[this.playerIndex];
|
const player = this.$store.state.players.players[this.playerIndex];
|
||||||
this.$store.commit("players/update", {
|
this.$store.commit("players/update", {
|
||||||
|
@ -105,4 +106,8 @@ ul.tokens li {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#townsquare.spectator ul.tokens li.traveler {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -110,6 +110,7 @@ class LiveSession {
|
||||||
* @param channel
|
* @param channel
|
||||||
*/
|
*/
|
||||||
connect(channel) {
|
connect(channel) {
|
||||||
|
this._store.commit("setPlayerCount", 0);
|
||||||
this._isSpectator = this._store.state.session.isSpectator;
|
this._isSpectator = this._store.state.session.isSpectator;
|
||||||
this._open(channel);
|
this._open(channel);
|
||||||
}
|
}
|
||||||
|
@ -118,6 +119,7 @@ class LiveSession {
|
||||||
* Close the current session, if any.
|
* Close the current session, if any.
|
||||||
*/
|
*/
|
||||||
disconnect() {
|
disconnect() {
|
||||||
|
this._store.commit("setPlayerCount", 0);
|
||||||
if (this._socket) {
|
if (this._socket) {
|
||||||
this._send("bye", this._playerId);
|
this._send("bye", this._playerId);
|
||||||
this._socket.close();
|
this._socket.close();
|
||||||
|
|
Loading…
Reference in New Issue