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 # 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 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 ### 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 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 - fix gamestate not stripping out special characters from role.id on load
- made character assignment modal a bit prettier - made character assignment modal a bit prettier

View File

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

View File

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