From 4120e5ec7227cef5e4ae4d7e3c99430f0b16bcc6 Mon Sep 17 00:00:00 2001 From: neru Date: Tue, 2 Jun 2026 03:57:42 -0300 Subject: [PATCH] feat: move href logic to state mgr --- src/app/fear/scene-components/creature.tsx | 1 - src/app/fear/state.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/fear/scene-components/creature.tsx b/src/app/fear/scene-components/creature.tsx index b06fca0..d04305d 100644 --- a/src/app/fear/scene-components/creature.tsx +++ b/src/app/fear/scene-components/creature.tsx @@ -70,7 +70,6 @@ export default function TheCreature() { camera.position.y += (Math.random() - 0.5) * shakeIntensity; if (globalDistance.current <= 0.1) { - window.location.href = '/'; fearState.registerCaught(); return; } diff --git a/src/app/fear/state.ts b/src/app/fear/state.ts index ef0e107..e23c95d 100644 --- a/src/app/fear/state.ts +++ b/src/app/fear/state.ts @@ -46,8 +46,14 @@ export const fearState = { this.currentWidth = newWidth; } - if (this.wasCaught && this.finaleProgression < FEAR_SETTINGS.EVENT_FINALE_DURATION) - this.finaleProgression = Math.min(this.finaleProgression + delta, FEAR_SETTINGS.EVENT_FINALE_DURATION); + if (this.wasCaught) { + if (this.finaleProgression < FEAR_SETTINGS.EVENT_FINALE_DURATION) { + + this.finaleProgression = Math.min(this.finaleProgression + delta, FEAR_SETTINGS.EVENT_FINALE_DURATION); + } else { + window.location.href = '/'; + } + } this.emit(); },