From 800222bbf5728054f3b4782164ffcc1a941b08b2 Mon Sep 17 00:00:00 2001 From: Tom Boullay Date: Mon, 11 May 2026 13:03:46 +0200 Subject: [PATCH] update: improve repair debug mission switching --- .../ui/debug/GameStateDebugPanel.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/ui/debug/GameStateDebugPanel.tsx b/src/components/ui/debug/GameStateDebugPanel.tsx index 27fc801..664153d 100644 --- a/src/components/ui/debug/GameStateDebugPanel.tsx +++ b/src/components/ui/debug/GameStateDebugPanel.tsx @@ -23,6 +23,9 @@ function toPascalCase(value: string): string { export function GameStateDebugPanel(): React.JSX.Element { const mainState = useGameStore((state) => state.mainState); + const bikeStep = useGameStore((state) => state.bike.currentStep); + const pyloneStep = useGameStore((state) => state.pylone.currentStep); + const fermeStep = useGameStore((state) => state.ferme.currentStep); const detail = useGameStore((state) => { switch (state.mainState) { case "intro": @@ -83,6 +86,24 @@ export function GameStateDebugPanel(): React.JSX.Element { } } + function setDebugMainState(nextMainState: MainGameState): void { + setMainState(nextMainState); + + if (nextMainState === "bike" && bikeStep === "locked") { + setBikeState({ currentStep: "waiting" }); + return; + } + + if (nextMainState === "pylone" && pyloneStep === "locked") { + setPyloneState({ currentStep: "waiting" }); + return; + } + + if (nextMainState === "ferme" && fermeStep === "locked") { + setFermeState({ currentStep: "waiting" }); + } + } + return (
setMainState(state)} + onClick={() => setDebugMainState(state)} > {toPascalCase(state)}