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.
This commit is contained in:
@@ -4,7 +4,6 @@ import { GameSettingsMenu } from "@/components/ui/GameSettingsMenu";
|
|||||||
import { HandTrackingFallback } from "@/components/ui/HandTrackingFallback";
|
import { HandTrackingFallback } from "@/components/ui/HandTrackingFallback";
|
||||||
import { HandTrackingVisualizer } from "@/components/ui/HandTrackingVisualizer";
|
import { HandTrackingVisualizer } from "@/components/ui/HandTrackingVisualizer";
|
||||||
import { InteractPrompt } from "@/components/ui/InteractPrompt";
|
import { InteractPrompt } from "@/components/ui/InteractPrompt";
|
||||||
import { RepairMovementLockIndicator } from "@/components/ui/RepairMovementLockIndicator";
|
|
||||||
import { Subtitles } from "@/components/ui/Subtitles";
|
import { Subtitles } from "@/components/ui/Subtitles";
|
||||||
import { TalkieDialogueOverlay } from "@/components/ui/TalkieDialogueOverlay";
|
import { TalkieDialogueOverlay } from "@/components/ui/TalkieDialogueOverlay";
|
||||||
|
|
||||||
@@ -13,7 +12,6 @@ export function GameUI(): React.JSX.Element {
|
|||||||
<>
|
<>
|
||||||
<DebugOverlayLayout />
|
<DebugOverlayLayout />
|
||||||
<Crosshair />
|
<Crosshair />
|
||||||
<RepairMovementLockIndicator />
|
|
||||||
<InteractPrompt />
|
<InteractPrompt />
|
||||||
<HandTrackingVisualizer />
|
<HandTrackingVisualizer />
|
||||||
<HandTrackingFallback />
|
<HandTrackingFallback />
|
||||||
|
|||||||
@@ -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 (
|
|
||||||
<div className="repair-movement-lock-indicator" aria-live="polite">
|
|
||||||
<span
|
|
||||||
className="repair-movement-lock-indicator__dot"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
<span>Déplacement verrouillé pendant la réparation</span>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -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"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,6 @@ import {
|
|||||||
PLAYER_MAX_DELTA,
|
PLAYER_MAX_DELTA,
|
||||||
PLAYER_XZ_DAMPING_FACTOR,
|
PLAYER_XZ_DAMPING_FACTOR,
|
||||||
} from "@/data/player/playerConfig";
|
} from "@/data/player/playerConfig";
|
||||||
import { useRepairMovementLocked } from "@/hooks/gameplay/useRepairMovementLocked";
|
|
||||||
import { useTerrainHeightSampler } from "@/hooks/three/useTerrainHeight";
|
import { useTerrainHeightSampler } from "@/hooks/three/useTerrainHeight";
|
||||||
import { InteractionManager } from "@/managers/InteractionManager";
|
import { InteractionManager } from "@/managers/InteractionManager";
|
||||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||||
@@ -154,9 +153,7 @@ export function PlayerController({
|
|||||||
}: PlayerControllerProps): null {
|
}: PlayerControllerProps): null {
|
||||||
const camera = useThree((state) => state.camera);
|
const camera = useThree((state) => state.camera);
|
||||||
const sceneMode = useSceneMode();
|
const sceneMode = useSceneMode();
|
||||||
const movementLocked = useRepairMovementLocked();
|
|
||||||
const terrainHeight = useTerrainHeightSampler();
|
const terrainHeight = useTerrainHeightSampler();
|
||||||
const movementLockedRef = useRef(movementLocked);
|
|
||||||
const keys = useRef<Keys>({ ...DEFAULT_KEYS });
|
const keys = useRef<Keys>({ ...DEFAULT_KEYS });
|
||||||
const velocity = useRef(new THREE.Vector3());
|
const velocity = useRef(new THREE.Vector3());
|
||||||
const fallDuration = useRef(0);
|
const fallDuration = useRef(0);
|
||||||
@@ -249,17 +246,6 @@ export function PlayerController({
|
|||||||
initializedRef.current = true;
|
initializedRef.current = true;
|
||||||
}, [camera, initialLookAt, spawnPosition]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
const interaction = InteractionManager.getInstance();
|
const interaction = InteractionManager.getInstance();
|
||||||
|
|
||||||
@@ -267,20 +253,11 @@ export function PlayerController({
|
|||||||
if (isPlayerInputLocked()) return;
|
if (isPlayerInputLocked()) return;
|
||||||
|
|
||||||
if (setMovementKey(keys.current, event.key, true)) {
|
if (setMovementKey(keys.current, event.key, true)) {
|
||||||
if (movementLockedRef.current) {
|
|
||||||
keys.current = { ...DEFAULT_KEYS };
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === JUMP_KEY) {
|
if (event.key === JUMP_KEY) {
|
||||||
if (movementLockedRef.current) {
|
|
||||||
wantsJump.current = false;
|
|
||||||
event.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wantsJump.current = true;
|
wantsJump.current = true;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
@@ -386,7 +363,7 @@ export function PlayerController({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_wishDir.set(0, 0, 0);
|
_wishDir.set(0, 0, 0);
|
||||||
if (!movementLocked && !isEbikeBreakdown) {
|
if (!isEbikeBreakdown) {
|
||||||
if (keys.current.forward) _wishDir.add(_forward);
|
if (keys.current.forward) _wishDir.add(_forward);
|
||||||
if (keys.current.backward) _wishDir.sub(_forward);
|
if (keys.current.backward) _wishDir.sub(_forward);
|
||||||
if (!isEbikeMounted) {
|
if (!isEbikeMounted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user