fix shifting player bug on delete (fixes #135)

This commit is contained in:
Steffen 2021-03-19 20:09:13 +01:00
parent 6a8f5608a1
commit da3a13518b
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
3 changed files with 32 additions and 16 deletions

View File

@ -1,11 +1,12 @@
# Release Notes
### Version 2.9.2
### Version 2.10.0
- added [nomination log indicator](https://fontawesome.com/icons/book-dead). When a nomination log [v] is available, the number of currently visible entries is displayed. Clicking the indicator can reveal/hide the nomination log.
- fix issue where a player and storyteller updating the same players pronouns at around the same time causes an infinite loop disconnecting the session.
- fix bug with shifting roles when the storyteller deletes a player
---
### Version 2.9.1
- added [nomination log indicator](https://fontawesome.com/icons/book-dead). When a nomination log [v] is available, the number of currently visible entries is displayed. Clicking the indicator can reveal/hide the nomination log.
- fix gamestate JSON not showing (custom) roles and failing to load states with custom scripts properly
- fix gamestate not stripping out special characters from role.id on load
- made character assignment modal a bit prettier

View File

@ -111,6 +111,15 @@
<transition name="fold">
<ul class="menu" v-if="isMenuOpen">
<li
@click="changePronouns"
v-if="
!session.isSpectator ||
(session.isSpectator && player.id === session.playerId)
"
>
<font-awesome-icon icon="venus-mars" />Change Pronouns
</li>
<template v-if="!session.isSpectator">
<li @click="changeName">
<font-awesome-icon icon="user-edit" />Rename
@ -127,10 +136,6 @@
<font-awesome-icon icon="exchange-alt" />
Swap seats
</li>
<li @click="removePlayer">
<font-awesome-icon icon="times-circle" />
Remove
</li>
<li
@click="updatePlayer('id', '', true)"
v-if="player.id && session.sessionId"
@ -138,6 +143,10 @@
<font-awesome-icon icon="chair" />
Empty seat
</li>
<li @click="removePlayer">
<font-awesome-icon icon="times-circle" />
Remove
</li>
</template>
<li
@click="claimSeat"
@ -153,15 +162,6 @@
</template>
<template v-else> Seat occupied</template>
</li>
<li
@click="changePronouns"
v-if="
!session.isSpectator ||
(session.isSpectator && player.id === session.playerId)
"
>
<font-awesome-icon icon="venus-mars" />Change Pronouns
</li>
</ul>
</transition>
</div>

View File

@ -164,6 +164,10 @@ class LiveSession {
if (!this._isSpectator) return;
this._store.commit("players/move", params);
break;
case "remove":
if (!this._isSpectator) return;
this._store.commit("players/remove", params);
break;
case "isNight":
if (!this._isSpectator) return;
this._store.commit("toggleNight", params);
@ -784,6 +788,15 @@ class LiveSession {
if (this._isSpectator) return;
this._send("move", payload);
}
/**
* Remove a player. ST only
* @param payload
*/
removePlayer(payload) {
if (this._isSpectator) return;
this._send("remove", payload);
}
}
export default store => {
@ -842,9 +855,11 @@ export default store => {
case "players/move":
session.movePlayer(payload);
break;
case "players/remove":
session.removePlayer(payload);
break;
case "players/set":
case "players/clear":
case "players/remove":
case "players/add":
session.sendGamestate("", true);
break;