6.9 KiB
Main Feature
This document explains the current repair-game flow in La-Fabrik.
What It Does
The main feature is a reusable repair flow mounted in the production game scene. It lets the player approach the active mission object, inspect it, fragment it, scan the broken part, install the correct replacement, validate completion, and move to the next mission state.
The current user flow is:
- Enter a mission state such as
bike,pylone, orferme. - Move close to the active repair object in the game scene.
- Aim at the object and press the interaction key when prompted.
- The mission step moves from
waitingtoinspected. - The repair case appears near the mission object and can float when the player approaches it.
- Press
Eor hold both fists closed for one second to move frominspectedtofragmented. - The mission object uses an exploded-model transition, then moves to
scanning. - The scan visual highlights the broken area and shows the
cassé.webmprompt. - In
repairing, the case opens and several grabbable replacement parts appear near the case. - Move the correct replacement part close to the install target.
- Press
Eon the green install target to move todoneand show the reassembled object. Wrong parts turn the target red and cannot finish the repair. - Press
Eon the completion target to callcompleteMissionand move to the next mission, or tooutroafterferme.
The older debug repair sandbox still exists in the physics test scene, but the production path now starts from the reusable RepairGame component.
Why It Matters
This feature validates the core repair fantasy before a full mission system exists. It tests whether repair objects, physical proximity, model selection, audio feedback, and exploded model visualization can work together in the 3D scene.
Current Behavior
In waiting, the active mission renders its repair object and the interagir.webm prompt in the game scene. The interaction uses the shared focus/raycast interaction system, so the player still gets the normal E prompt.
When the player inspects the object, RepairGame writes inspected through the generic mission store action. The repair case then appears from the mission config. When the player is close enough, the existing case model floats upward and rotates gently to signal interactivity.
In inspected, RepairGame can also move to fragmented. The player can use the interaction key or hold both fists closed for one second. The hand-tracking path is state-based, so it does not depend on being inside a local object interaction radius.
In fragmented, the repair object is rendered with ExplodableModel, then automatically advances to scanning. In scanning, a blue scan visual and the cassé.webm prompt are shown before the flow advances to repairing. In repairing, the case opens, several grabbable replacement parts appear, and the install target only validates the configured correct part for the active mission. In done, the repaired object remains visible with a completion target that advances the global mission progression.
Repair module slots and model-selection behavior still exist in the debug prototype. They can be migrated into the reusable repair flow in later steps if the repair interaction needs more depth.
Key Files
src/world/debug/TestMap.tsxmounts the repair-game prototype in the debug physics scene.src/world/GameStageContent.tsxmounts productionRepairGameinstances forbike,pylone, andferme.src/components/three/gameplay/RepairCompletionStep.tsxrenders the final repaired object, completion target, and mission UI prompt.src/components/three/gameplay/RepairGame.tsxcomposes the reusable production repair flow.src/components/three/gameplay/RepairInspectionObject.tsxhandles thewaitinginspection interaction.src/components/three/gameplay/RepairMissionCase.tsxrenders the mission repair case after inspection.src/components/three/gameplay/RepairRepairingStep.tsxrenders grabbable replacement choices, correct-part placement validation, and the install trigger inrepairing.src/components/three/gameplay/RepairPromptVideo.tsxrenders.webmprompts inside the 3D scene.src/components/three/gameplay/RepairScanVisual.tsxrenders the scan halo, scan line, and broken prompt.src/hooks/gameplay/useRepairFragmentationInput.tshandles theinspected -> fragmentedkeyboard and hand-tracking input.src/hooks/gameplay/useRepairMissionStep.tsreads the active mission step from the game store.src/hooks/handTracking/useBothFistsHold.tsdetects the reusable two-fists hold gesture.src/components/three/gameplay/RepairGameZone.tsxcomposes the repair-game zone.src/components/three/gameplay/RepairCaseObject.tsxconnects the repair case to trigger interaction and audio.src/components/three/gameplay/RepairCaseModel.tsxrenders and animates the case model.src/components/three/gameplay/RepairModuleSlot.tsxrenders repair slots and model selection behavior.src/components/three/models/ExplodableModel.tsxrenders selectable models with split/exploded visualization.src/data/gameplay/repairCaseConfig.tsstores repair case model, sound, and animation constants.src/data/gameplay/repairGameConfig.tsstores repair zone and slot positions.src/data/gameplay/repairGameModelCatalog.tsstores selectable repair models.src/data/gameplay/repairMissions.tsstores reusable repair mission config forbike,pylone, andferme.src/managers/stores/useGameStore.tsstores mission progression state and generic mission step helpers.
Runtime Requirements
The production repair flow currently requires:
- the active
mainStateto be one ofbike,pylone, orferme GameStageContentmounted inside the game scene RapierPhysicsboundary- model assets available under
public/models/ - sound assets available under
public/sounds/
Frontend command:
npm run dev
Debug URL for state switching and inspection:
http://localhost:5173/?debug
Related Hand Tracking
Hand tracking can move grabbable physics objects with webcam input in debug scenes. In the production repair flow, it is also used for the inspected -> fragmented transition through the two-fists hold gesture.
For hand tracking, run the Python backend separately:
source backend/.venv/bin/activate
python -m backend.main
Current Limitations
- The reusable production
RepairGamecurrently coverswaiting -> inspected -> fragmented -> scanning -> repairing -> done -> next mission. - Mission progression is wired through Zustand using
completeMissionat the end of each repair. - There is no central
GameManagerin this branch. - Hand tracking is available for the two-fists input and grabbable replacement parts; final installation still uses the shared
Etrigger path. - The repair-game content is configured statically in
src/data/gameplay/.