From 2a6a028e1dc5ef478bcae28a356b6555a4850e18 Mon Sep 17 00:00:00 2001 From: Tom Boullay Date: Tue, 2 Jun 2026 22:04:05 +0200 Subject: [PATCH] revert(repair): remove player movement lock during repair Drops the useRepairMovementLocked hook, the RepairMovementLockIndicator overlay, and all PlayerController gating tied to repair sub-states. The repair flow no longer freezes player movement or shows a lock banner; the player keeps full control while interacting with the case. --- src/components/ui/GameUI.tsx | 2 -- .../ui/RepairMovementLockIndicator.tsx | 20 ------------- src/hooks/gameplay/useRepairMovementLocked.ts | 29 ------------------- src/world/player/PlayerController.tsx | 25 +--------------- 4 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 src/components/ui/RepairMovementLockIndicator.tsx delete mode 100644 src/hooks/gameplay/useRepairMovementLocked.ts diff --git a/src/components/ui/GameUI.tsx b/src/components/ui/GameUI.tsx index c7a1b49..158a9dc 100644 --- a/src/components/ui/GameUI.tsx +++ b/src/components/ui/GameUI.tsx @@ -4,7 +4,6 @@ import { GameSettingsMenu } from "@/components/ui/GameSettingsMenu"; import { HandTrackingFallback } from "@/components/ui/HandTrackingFallback"; import { HandTrackingVisualizer } from "@/components/ui/HandTrackingVisualizer"; import { InteractPrompt } from "@/components/ui/InteractPrompt"; -import { RepairMovementLockIndicator } from "@/components/ui/RepairMovementLockIndicator"; import { Subtitles } from "@/components/ui/Subtitles"; import { TalkieDialogueOverlay } from "@/components/ui/TalkieDialogueOverlay"; @@ -13,7 +12,6 @@ export function GameUI(): React.JSX.Element { <> - diff --git a/src/components/ui/RepairMovementLockIndicator.tsx b/src/components/ui/RepairMovementLockIndicator.tsx deleted file mode 100644 index 4f8d825..0000000 --- a/src/components/ui/RepairMovementLockIndicator.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { useCameraMode } from "@/hooks/debug/useCameraMode"; -import { useRepairMovementLocked } from "@/hooks/gameplay/useRepairMovementLocked"; - -export function RepairMovementLockIndicator(): React.JSX.Element | null { - const cameraMode = useCameraMode(); - const movementLocked = useRepairMovementLocked(); - - if (cameraMode !== "player") return null; - if (!movementLocked) return null; - - return ( -
-
- ); -} diff --git a/src/hooks/gameplay/useRepairMovementLocked.ts b/src/hooks/gameplay/useRepairMovementLocked.ts deleted file mode 100644 index 36b951a..0000000 --- a/src/hooks/gameplay/useRepairMovementLocked.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { useGameStore } from "@/managers/stores/useGameStore"; -import type { MissionStep } from "@/types/gameplay/repairMission"; - -export function useRepairMovementLocked(): boolean { - return useGameStore((state) => { - switch (state.mainState) { - case "ebike": - return isRepairMovementLocked(state.ebike.currentStep); - case "pylon": - return isRepairMovementLocked(state.pylon.currentStep); - case "farm": - return isRepairMovementLocked(state.farm.currentStep); - case "intro": - case "outro": - return false; - } - }); -} - -function isRepairMovementLocked(step: MissionStep): boolean { - return ( - step === "inspected" || - step === "fragmented" || - step === "scanning" || - step === "repairing" || - step === "reassembling" || - step === "done" - ); -} diff --git a/src/world/player/PlayerController.tsx b/src/world/player/PlayerController.tsx index cfe3dd9..72cd0f2 100644 --- a/src/world/player/PlayerController.tsx +++ b/src/world/player/PlayerController.tsx @@ -23,7 +23,6 @@ import { PLAYER_MAX_DELTA, PLAYER_XZ_DAMPING_FACTOR, } from "@/data/player/playerConfig"; -import { useRepairMovementLocked } from "@/hooks/gameplay/useRepairMovementLocked"; import { useTerrainHeightSampler } from "@/hooks/three/useTerrainHeight"; import { InteractionManager } from "@/managers/InteractionManager"; import { useGameStore } from "@/managers/stores/useGameStore"; @@ -154,9 +153,7 @@ export function PlayerController({ }: PlayerControllerProps): null { const camera = useThree((state) => state.camera); const sceneMode = useSceneMode(); - const movementLocked = useRepairMovementLocked(); const terrainHeight = useTerrainHeightSampler(); - const movementLockedRef = useRef(movementLocked); const keys = useRef({ ...DEFAULT_KEYS }); const velocity = useRef(new THREE.Vector3()); const fallDuration = useRef(0); @@ -249,17 +246,6 @@ export function PlayerController({ initializedRef.current = true; }, [camera, initialLookAt, spawnPosition]); - useEffect(() => { - movementLockedRef.current = movementLocked; - - if (!movementLocked) return; - - keys.current = { ...DEFAULT_KEYS }; - wantsJump.current = false; - velocity.current.setX(0); - velocity.current.setZ(0); - }, [movementLocked]); - useEffect(() => { const interaction = InteractionManager.getInstance(); @@ -267,20 +253,11 @@ export function PlayerController({ if (isPlayerInputLocked()) return; if (setMovementKey(keys.current, event.key, true)) { - if (movementLockedRef.current) { - keys.current = { ...DEFAULT_KEYS }; - } event.preventDefault(); return; } if (event.key === JUMP_KEY) { - if (movementLockedRef.current) { - wantsJump.current = false; - event.preventDefault(); - return; - } - wantsJump.current = true; event.preventDefault(); return; @@ -386,7 +363,7 @@ export function PlayerController({ } _wishDir.set(0, 0, 0); - if (!movementLocked && !isEbikeBreakdown) { + if (!isEbikeBreakdown) { if (keys.current.forward) _wishDir.add(_forward); if (keys.current.backward) _wishDir.sub(_forward); if (!isEbikeMounted) {