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; break;
case "s": case "s":
if (this.session.isSpectator) return; if (this.session.isSpectator) return;
this.$store.commit("toggleNight"); this.$refs.menu.toggleNight();
break; break;
case "escape": case "escape":
this.$store.commit("toggleModal"); this.$store.commit("toggleModal");

View File

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

View File

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