its functionning

This commit is contained in:
math-pixel
2026-06-02 00:23:43 +02:00
parent d975aac018
commit a3e8e732f1
9 changed files with 407 additions and 68 deletions
@@ -0,0 +1,33 @@
import { create } from "zustand";
import type { MissionStep, RepairMissionId } from "@/types/gameplay/repairMission";
import type { Vector3Tuple } from "@/types/three/three";
export interface RepairPendingCompletion {
mission: RepairMissionId;
/** Next step to set. When it equals "done", completeMission() is called
* instead (ebike / farm have no further narrative sub-step). */
nextStep: MissionStep;
}
interface RepairTransitionState {
/** Set when the repair game reaches "done". page.tsx reads this and
* executes the completion only after the world has fully re-loaded. */
pendingCompletion: RepairPendingCompletion | null;
/** Player 3D position captured just before entering the repair scene,
* used to re-spawn the player at the correct location on return. */
savedPlayerPosition: Vector3Tuple | null;
}
interface RepairTransitionActions {
setPendingCompletion: (data: RepairPendingCompletion | null) => void;
setSavedPlayerPosition: (pos: Vector3Tuple | null) => void;
}
export const useRepairTransitionStore = create<
RepairTransitionState & RepairTransitionActions
>()((set) => ({
pendingCompletion: null,
savedPlayerPosition: null,
setPendingCompletion: (data) => set({ pendingCompletion: data }),
setSavedPlayerPosition: (pos) => set({ savedPlayerPosition: pos }),
}));