Get rid of buggy open state

This commit is contained in:
PizZaKatZe 2021-12-20 12:50:43 +01:00
parent 3916d9c58e
commit 21b1313a18
4 changed files with 5 additions and 12 deletions

View File

@ -42,7 +42,8 @@
import AudioManager from "./AudioManager/AudioManager.svelte"; import AudioManager from "./AudioManager/AudioManager.svelte";
import { showReportScreenStore, userReportEmpty } from "../Stores/ShowReportScreenStore"; import { showReportScreenStore, userReportEmpty } from "../Stores/ShowReportScreenStore";
import ReportMenu from "./ReportMenu/ReportMenu.svelte"; import ReportMenu from "./ReportMenu/ReportMenu.svelte";
import { followStateStore, followRoleStore, followStates, followRoles } from "../Stores/FollowStore"; import { followStateStore, followStates } from "../Stores/FollowStore";
import { peerStore } from "../Stores/PeerStore";
import FollowMenu from "./FollowMenu/FollowMenu.svelte"; import FollowMenu from "./FollowMenu/FollowMenu.svelte";
export let game: Game; export let game: Game;
@ -104,7 +105,7 @@
<ReportMenu /> <ReportMenu />
</div> </div>
{/if} {/if}
{#if $followStateStore !== followStates.off || $followRoleStore === followRoles.open} {#if $followStateStore !== followStates.off || $peerStore.size > 0}
<div> <div>
<FollowMenu /> <FollowMenu />
</div> </div>

View File

@ -158,7 +158,7 @@ vim: ft=typescript
</div> </div>
{/if} {/if}
{#if followRole === followRoles.open} {#if followState === followStates.off}
<button <button
type="button" type="button"
class="nes-btn is-primary follow-menu-button" class="nes-btn is-primary follow-menu-button"
@ -175,7 +175,7 @@ vim: ft=typescript
on:click|preventDefault={reset} on:click|preventDefault={reset}
title="Stop following"><img class="background-img" src={followImg} alt="" /></button title="Stop following"><img class="background-img" src={followImg} alt="" /></button
> >
{:else if followUsers.length > 0} {:else}
<button <button
type="button" type="button"
class="nes-btn is-error follow-menu-button" class="nes-btn is-error follow-menu-button"

View File

@ -114,13 +114,6 @@ export class Player extends Character {
const state = get(followStateStore); const state = get(followStateStore);
const role = get(followRoleStore); const role = get(followRoleStore);
if (state === followStates.off && this.scene.groups.size > 0) {
followRoleStore.set(followRoles.open);
} else if (this.scene.groups.size == 0) {
followStateStore.set(followStates.off);
followRoleStore.set(followRoles.leader);
}
if (activeEvents.get(UserInputEvent.Follow)) { if (activeEvents.get(UserInputEvent.Follow)) {
if (state === followStates.off && this.scene.groups.size > 0) { if (state === followStates.off && this.scene.groups.size > 0) {
followStateStore.set(followStates.requesting); followStateStore.set(followStates.requesting);

View File

@ -8,7 +8,6 @@ export const followStates = {
}; };
export const followRoles = { export const followRoles = {
open: "open",
leader: "leader", leader: "leader",
follower: "follower", follower: "follower",
}; };