move block/night logic from socket to menu

This commit is contained in:
nicfreeman1209 2021-05-05 11:54:48 +01:00
parent 946bafec5b
commit 8dacfea0cb
3 changed files with 7 additions and 5 deletions

View File

@ -116,7 +116,7 @@ export default {
break;
case "s":
if (this.session.isSpectator) return;
this.$store.commit("toggleNight");
this.$refs.menu.toggleNight();
break;
case "escape":
this.$store.commit("toggleModal");

View File

@ -327,12 +327,17 @@ export default {
this.$store.dispatch("players/clearRoles");
}
},
toggleNight() {
this.$store.commit("toggleNight");
if (this.grimoire.isNight) {
this.$store.commit("players/setOnBlock", -1);
}
},
...mapMutations([
"toggleGrimoire",
"toggleMenu",
"toggleImageOptIn",
"toggleMuted",
"toggleNight",
"toggleNightOrder",
"setZoom",
"toggleModal"

View File

@ -691,9 +691,6 @@ class LiveSession {
setIsNight() {
if (this._isSpectator) return;
this._send("isNight", this._store.state.grimoire.isNight);
if (this._store.state.grimoire.isNight) {
this._store.commit("players/setOnBlock", -1);
}
}
/**