fix(pylon): delay approach sequence trigger

This commit is contained in:
Tom Boullay
2026-06-03 07:23:30 +02:00
parent 5968f0f67c
commit 063ee20202
4 changed files with 29 additions and 4 deletions
@@ -5,7 +5,10 @@ import { ZoneDetection } from "@/components/zone/ZoneDetection";
import { PylonFarmerNPC } from "@/components/gameplay/pylon/PylonFarmerNPC"; import { PylonFarmerNPC } from "@/components/gameplay/pylon/PylonFarmerNPC";
import { PylonNarratorOutro } from "@/components/gameplay/pylon/PylonNarratorOutro"; import { PylonNarratorOutro } from "@/components/gameplay/pylon/PylonNarratorOutro";
import { PYLON_APPROACH_ZONE, PYLON_ARRIVED_ZONE } from "@/data/gameplay/zones"; 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 { AudioManager } from "@/managers/AudioManager";
import { loadDialogueManifest } from "@/utils/dialogues/loadDialogueManifest"; import { loadDialogueManifest } from "@/utils/dialogues/loadDialogueManifest";
import { playDialogueById } from "@/utils/dialogues/playDialogue"; import { playDialogueById } from "@/utils/dialogues/playDialogue";
@@ -19,6 +22,18 @@ export function PylonNarrativeFlow(): React.JSX.Element | null {
const setMissionStep = useGameStore((state) => state.setMissionStep); const setMissionStep = useGameStore((state) => state.setMissionStep);
const setCanMove = useGameStore((state) => state.setCanMove); 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 ──────────── // ── approaching : powerdown sfx → then electricOutage dialogue ────────────
useEffect(() => { useEffect(() => {
if (mainState !== "pylon" || step !== "approaching") return undefined; if (mainState !== "pylon" || step !== "approaching") return undefined;
@@ -129,7 +144,7 @@ export function PylonNarrativeFlow(): React.JSX.Element | null {
<ZoneDetection <ZoneDetection
key="pylon-approach" key="pylon-approach"
zone={PYLON_APPROACH_ZONE} zone={PYLON_APPROACH_ZONE}
onEnter={() => setMissionStep("pylon", "approaching")} onEnter={() => setMissionStep("pylon", "tampon")}
/> />
); );
} }
+2
View File
@@ -41,6 +41,8 @@ export const PYLON_NARRATIVE_INTERACT_RADIUS = 3.5;
export const PYLON_STRAIGHTEN_ANIMATION_DURATION_MS = 2200; export const PYLON_STRAIGHTEN_ANIMATION_DURATION_MS = 2200;
export const PYLON_APPROACH_DELAY_MS = 7500;
export const PYLON_NARRATIVE_DIALOGUES = { export const PYLON_NARRATIVE_DIALOGUES = {
electricOutage: "narrateur_coupureelec", electricOutage: "narrateur_coupureelec",
searchCentral: "narrateur_fouillelecentre", searchCentral: "narrateur_fouillelecentre",
+8 -2
View File
@@ -11,6 +11,7 @@ const REPAIR_MISSION_ID_VALUES: ReadonlySet<string> = new Set(
export const MISSION_STEPS = [ export const MISSION_STEPS = [
"locked", "locked",
"electricienne_history", "electricienne_history",
"tampon",
"approaching", "approaching",
"arrived", "arrived",
"npc-return", "npc-return",
@@ -26,6 +27,7 @@ export const MISSION_STEPS = [
const MISSION_STEP_VALUES: ReadonlySet<string> = new Set(MISSION_STEPS); const MISSION_STEP_VALUES: ReadonlySet<string> = new Set(MISSION_STEPS);
const PYLON_ONLY_MISSION_STEPS = new Set<MissionStep>([ const PYLON_ONLY_MISSION_STEPS = new Set<MissionStep>([
"tampon",
"approaching", "approaching",
"arrived", "arrived",
"npc-return", "npc-return",
@@ -61,9 +63,11 @@ export function getNextMissionStep(
): MissionStep { ): MissionStep {
switch (step) { switch (step) {
case "locked": case "locked":
return mission === "pylon" ? "approaching" : "waiting"; return mission === "pylon" ? "tampon" : "waiting";
case "electricienne_history": case "electricienne_history":
return "done"; return "done";
case "tampon":
return "approaching";
case "approaching": case "approaching":
return "arrived"; return "arrived";
case "arrived": case "arrived":
@@ -98,8 +102,10 @@ export function getPreviousMissionStep(
return "locked"; return "locked";
case "electricienne_history": case "electricienne_history":
return "locked"; return "locked";
case "approaching": case "tampon":
return "locked"; return "locked";
case "approaching":
return "tampon";
case "arrived": case "arrived":
return "approaching"; return "approaching";
case "npc-return": case "npc-return":
+2
View File
@@ -99,6 +99,7 @@ export interface RepairMissionConfig {
export type MissionStep = export type MissionStep =
| "locked" | "locked"
| "tampon"
| "approaching" | "approaching"
| "arrived" | "arrived"
| "npc-return" | "npc-return"
@@ -113,6 +114,7 @@ export type MissionStep =
| "electricienne_history"; | "electricienne_history";
export const PYLON_NARRATIVE_STEPS = [ export const PYLON_NARRATIVE_STEPS = [
"tampon",
"approaching", "approaching",
"arrived", "arrived",
"npc-return", "npc-return",