From 063ee20202bd76690d2c9bc0b146bb94e27e6a68 Mon Sep 17 00:00:00 2001 From: Tom Boullay Date: Wed, 3 Jun 2026 07:23:30 +0200 Subject: [PATCH] fix(pylon): delay approach sequence trigger --- .../gameplay/pylon/PylonNarrativeFlow.tsx | 19 +++++++++++++++++-- src/data/gameplay/pylonConfig.ts | 2 ++ src/data/gameplay/repairMissionState.ts | 10 ++++++++-- src/types/gameplay/repairMission.ts | 2 ++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/components/gameplay/pylon/PylonNarrativeFlow.tsx b/src/components/gameplay/pylon/PylonNarrativeFlow.tsx index 724b2c9..23f655c 100644 --- a/src/components/gameplay/pylon/PylonNarrativeFlow.tsx +++ b/src/components/gameplay/pylon/PylonNarrativeFlow.tsx @@ -5,7 +5,10 @@ import { ZoneDetection } from "@/components/zone/ZoneDetection"; import { PylonFarmerNPC } from "@/components/gameplay/pylon/PylonFarmerNPC"; import { PylonNarratorOutro } from "@/components/gameplay/pylon/PylonNarratorOutro"; import { PYLON_APPROACH_ZONE, PYLON_ARRIVED_ZONE } from "@/data/gameplay/zones"; -import { PYLON_NARRATIVE_DIALOGUES } from "@/data/gameplay/pylonConfig"; +import { + PYLON_APPROACH_DELAY_MS, + PYLON_NARRATIVE_DIALOGUES, +} from "@/data/gameplay/pylonConfig"; import { AudioManager } from "@/managers/AudioManager"; import { loadDialogueManifest } from "@/utils/dialogues/loadDialogueManifest"; import { playDialogueById } from "@/utils/dialogues/playDialogue"; @@ -19,6 +22,18 @@ export function PylonNarrativeFlow(): React.JSX.Element | null { const setMissionStep = useGameStore((state) => state.setMissionStep); const setCanMove = useGameStore((state) => state.setCanMove); + useEffect(() => { + if (mainState !== "pylon" || step !== "tampon") return undefined; + + const timeoutId = window.setTimeout(() => { + setMissionStep("pylon", "approaching"); + }, PYLON_APPROACH_DELAY_MS); + + return () => { + window.clearTimeout(timeoutId); + }; + }, [mainState, setMissionStep, step]); + // ── approaching : powerdown sfx → then electricOutage dialogue ──────────── useEffect(() => { if (mainState !== "pylon" || step !== "approaching") return undefined; @@ -129,7 +144,7 @@ export function PylonNarrativeFlow(): React.JSX.Element | null { setMissionStep("pylon", "approaching")} + onEnter={() => setMissionStep("pylon", "tampon")} /> ); } diff --git a/src/data/gameplay/pylonConfig.ts b/src/data/gameplay/pylonConfig.ts index 6efafc1..a3a094f 100644 --- a/src/data/gameplay/pylonConfig.ts +++ b/src/data/gameplay/pylonConfig.ts @@ -41,6 +41,8 @@ export const PYLON_NARRATIVE_INTERACT_RADIUS = 3.5; export const PYLON_STRAIGHTEN_ANIMATION_DURATION_MS = 2200; +export const PYLON_APPROACH_DELAY_MS = 7500; + export const PYLON_NARRATIVE_DIALOGUES = { electricOutage: "narrateur_coupureelec", searchCentral: "narrateur_fouillelecentre", diff --git a/src/data/gameplay/repairMissionState.ts b/src/data/gameplay/repairMissionState.ts index 59745b5..38ceb9c 100644 --- a/src/data/gameplay/repairMissionState.ts +++ b/src/data/gameplay/repairMissionState.ts @@ -11,6 +11,7 @@ const REPAIR_MISSION_ID_VALUES: ReadonlySet = new Set( export const MISSION_STEPS = [ "locked", "electricienne_history", + "tampon", "approaching", "arrived", "npc-return", @@ -26,6 +27,7 @@ export const MISSION_STEPS = [ const MISSION_STEP_VALUES: ReadonlySet = new Set(MISSION_STEPS); const PYLON_ONLY_MISSION_STEPS = new Set([ + "tampon", "approaching", "arrived", "npc-return", @@ -61,9 +63,11 @@ export function getNextMissionStep( ): MissionStep { switch (step) { case "locked": - return mission === "pylon" ? "approaching" : "waiting"; + return mission === "pylon" ? "tampon" : "waiting"; case "electricienne_history": return "done"; + case "tampon": + return "approaching"; case "approaching": return "arrived"; case "arrived": @@ -98,8 +102,10 @@ export function getPreviousMissionStep( return "locked"; case "electricienne_history": return "locked"; - case "approaching": + case "tampon": return "locked"; + case "approaching": + return "tampon"; case "arrived": return "approaching"; case "npc-return": diff --git a/src/types/gameplay/repairMission.ts b/src/types/gameplay/repairMission.ts index a95c09c..569ef55 100644 --- a/src/types/gameplay/repairMission.ts +++ b/src/types/gameplay/repairMission.ts @@ -99,6 +99,7 @@ export interface RepairMissionConfig { export type MissionStep = | "locked" + | "tampon" | "approaching" | "arrived" | "npc-return" @@ -113,6 +114,7 @@ export type MissionStep = | "electricienne_history"; export const PYLON_NARRATIVE_STEPS = [ + "tampon", "approaching", "arrived", "npc-return",