its functionning
This commit is contained in:
@@ -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 }),
|
||||
}));
|
||||
Reference in New Issue
Block a user