fix repair game suspense boundaries
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { Suspense, useEffect, useState } from "react";
|
||||||
import { ExplodableModel } from "@/components/three/models/ExplodableModel";
|
import { ExplodableModel } from "@/components/three/models/ExplodableModel";
|
||||||
import type { RepairCasePlaceholder } from "@/components/three/gameplay/RepairCaseModel";
|
import type { RepairCasePlaceholder } from "@/components/three/gameplay/RepairCaseModel";
|
||||||
import { RepairCompletionStep } from "@/components/three/gameplay/RepairCompletionStep";
|
import { RepairCompletionStep } from "@/components/three/gameplay/RepairCompletionStep";
|
||||||
@@ -71,54 +71,56 @@ export function RepairGame({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<group position={position} rotation={rotation} scale={parsedScale}>
|
<group position={position} rotation={rotation} scale={parsedScale}>
|
||||||
{step === "waiting" ? (
|
<Suspense fallback={null}>
|
||||||
<RepairInspectionObject
|
{step === "waiting" ? (
|
||||||
config={config}
|
<RepairInspectionObject
|
||||||
worldPosition={position}
|
config={config}
|
||||||
onInspect={() => setMissionStep(mission, "inspected")}
|
worldPosition={position}
|
||||||
/>
|
onInspect={() => setMissionStep(mission, "inspected")}
|
||||||
) : null}
|
/>
|
||||||
{step === "fragmented" ? (
|
) : null}
|
||||||
<ExplodableModel modelPath={config.modelPath} split />
|
{step === "fragmented" ? (
|
||||||
) : null}
|
<ExplodableModel modelPath={config.modelPath} split />
|
||||||
{step === "scanning" ? (
|
) : null}
|
||||||
<RepairScanSequence
|
{step === "scanning" ? (
|
||||||
config={config}
|
<RepairScanSequence
|
||||||
onComplete={(brokenParts) => {
|
config={config}
|
||||||
setScannedBrokenParts(brokenParts);
|
onComplete={(brokenParts) => {
|
||||||
setMissionStep(mission, "repairing");
|
setScannedBrokenParts(brokenParts);
|
||||||
}}
|
setMissionStep(mission, "repairing");
|
||||||
/>
|
}}
|
||||||
) : null}
|
/>
|
||||||
{step === "repairing" ? (
|
) : null}
|
||||||
<RepairRepairingStep
|
{step === "repairing" ? (
|
||||||
brokenParts={scannedBrokenParts}
|
<RepairRepairingStep
|
||||||
config={config}
|
brokenParts={scannedBrokenParts}
|
||||||
placeholders={casePlaceholders}
|
config={config}
|
||||||
onRepair={() => setMissionStep(mission, "reassembling")}
|
placeholders={casePlaceholders}
|
||||||
/>
|
onRepair={() => setMissionStep(mission, "reassembling")}
|
||||||
) : null}
|
/>
|
||||||
{step === "reassembling" ? (
|
) : null}
|
||||||
<RepairReassemblyStep
|
{step === "reassembling" ? (
|
||||||
config={config}
|
<RepairReassemblyStep
|
||||||
onComplete={() => setMissionStep(mission, "done")}
|
config={config}
|
||||||
/>
|
onComplete={() => setMissionStep(mission, "done")}
|
||||||
) : null}
|
/>
|
||||||
{step === "done" ? (
|
) : null}
|
||||||
<RepairCompletionStep
|
{step === "done" ? (
|
||||||
config={config}
|
<RepairCompletionStep
|
||||||
onComplete={() => completeMission(mission)}
|
config={config}
|
||||||
/>
|
onComplete={() => completeMission(mission)}
|
||||||
) : null}
|
/>
|
||||||
{step !== "waiting" && step !== "done" && step !== "reassembling" ? (
|
) : null}
|
||||||
<RepairMissionCase
|
{step !== "waiting" && step !== "done" && step !== "reassembling" ? (
|
||||||
config={config}
|
<RepairMissionCase
|
||||||
onPlaceholdersChange={setCasePlaceholders}
|
config={config}
|
||||||
open={step === "repairing"}
|
onPlaceholdersChange={setCasePlaceholders}
|
||||||
zoomed={step === "repairing"}
|
open={step === "repairing"}
|
||||||
showFragmentationPrompt={readyForFragmentation}
|
zoomed={step === "repairing"}
|
||||||
/>
|
showFragmentationPrompt={readyForFragmentation}
|
||||||
) : null}
|
/>
|
||||||
|
) : null}
|
||||||
|
</Suspense>
|
||||||
</group>
|
</group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
|
import { Suspense } from "react";
|
||||||
import { Physics } from "@react-three/rapier";
|
import { Physics } from "@react-three/rapier";
|
||||||
import {
|
import {
|
||||||
PLAYER_SPAWN_POSITION_GAME,
|
PLAYER_SPAWN_POSITION_GAME,
|
||||||
@@ -43,10 +44,10 @@ export function World({ onLoadingStateChange }: WorldProps): React.JSX.Element {
|
|||||||
<Lighting />
|
<Lighting />
|
||||||
<DebugHelpers />
|
<DebugHelpers />
|
||||||
{showHandTrackingGloves ? (
|
{showHandTrackingGloves ? (
|
||||||
<>
|
<Suspense fallback={null}>
|
||||||
<HandTrackingGlove handedness="left" />
|
<HandTrackingGlove handedness="left" />
|
||||||
<HandTrackingGlove handedness="right" />
|
<HandTrackingGlove handedness="right" />
|
||||||
</>
|
</Suspense>
|
||||||
) : null}
|
) : null}
|
||||||
{cameraMode === "debug" ? <DebugCameraControls /> : null}
|
{cameraMode === "debug" ? <DebugCameraControls /> : null}
|
||||||
{sceneMode === "game" ? (
|
{sceneMode === "game" ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user