fix: ebike
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (pull_request) Has been cancelled
📊 Quality / 🔒 Security Audit (pull_request) Has been cancelled
📊 Quality / 📋 Dependency Freshness (pull_request) Has been cancelled
📊 Quality / 📦 Bundle Size (pull_request) Has been cancelled
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (pull_request) Has been cancelled
📊 Quality / 🔒 Security Audit (pull_request) Has been cancelled
📊 Quality / 📋 Dependency Freshness (pull_request) Has been cancelled
📊 Quality / 📦 Bundle Size (pull_request) Has been cancelled
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import type { Vector3Tuple } from "@/types/three/three";
|
||||
|
||||
export const EBIKE_REPAIR_POSITION = [
|
||||
42.2399, 4.5484, 34.6468,
|
||||
] as const satisfies Vector3Tuple;
|
||||
@@ -124,7 +124,7 @@ function completeIntroState(state: GameState): GameStateUpdate {
|
||||
},
|
||||
bike: {
|
||||
...state.bike,
|
||||
currentStep: "waiting",
|
||||
currentStep: "locked",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
+16
-1
@@ -19,6 +19,7 @@ import {
|
||||
isMapModelVisible,
|
||||
useMapPerformanceStore,
|
||||
} from "@/managers/stores/useMapPerformanceStore";
|
||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||
import { GameMapCollision } from "@/world/GameMapCollision";
|
||||
import { CloudSystem } from "@/world/clouds/CloudSystem";
|
||||
import { GeneratedMapNodeInstance } from "@/world/map-generated/GeneratedMapNodeInstance";
|
||||
@@ -302,8 +303,12 @@ function MapNodeInstance({
|
||||
node: MapNode;
|
||||
modelUrl: string | null;
|
||||
onSettled: () => void;
|
||||
}): React.JSX.Element {
|
||||
}): React.JSX.Element | null {
|
||||
const isGeneratedModel = isGeneratedMapModelName(node.name);
|
||||
const mainState = useGameStore((state) => state.mainState);
|
||||
const bikeStep = useGameStore((state) => state.bike.currentStep);
|
||||
const hideEbikeMapModel =
|
||||
node.name === "ebike" && mainState === "bike" && bikeStep !== "locked";
|
||||
|
||||
useEffect(() => {
|
||||
if (modelUrl !== null || isGeneratedModel) return;
|
||||
@@ -311,6 +316,16 @@ function MapNodeInstance({
|
||||
onSettled();
|
||||
}, [isGeneratedModel, modelUrl, onSettled]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!hideEbikeMapModel) return;
|
||||
|
||||
onSettled();
|
||||
}, [hideEbikeMapModel, onSettled]);
|
||||
|
||||
if (hideEbikeMapModel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isGeneratedModel) {
|
||||
return (
|
||||
<Suspense fallback={<FallbackMapNode node={node} />}>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { InteractableObject } from "@/components/three/interaction/InteractableObject";
|
||||
import { RepairGame } from "@/components/three/gameplay/RepairGame";
|
||||
import { EBIKE_REPAIR_POSITION } from "@/data/gameplay/repairMissionAnchors";
|
||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||
import type { RepairMissionId } from "@/types/gameplay/repairMission";
|
||||
import type { Vector3Tuple } from "@/types/three/three";
|
||||
@@ -17,7 +19,7 @@ interface GameRepairZone {
|
||||
const GAME_REPAIR_ZONES = [
|
||||
{
|
||||
mission: "bike",
|
||||
position: [8, 0, -6],
|
||||
position: EBIKE_REPAIR_POSITION,
|
||||
},
|
||||
{
|
||||
mission: "pylone",
|
||||
@@ -48,6 +50,31 @@ function StageAnchor({
|
||||
);
|
||||
}
|
||||
|
||||
function EbikeMissionTrigger(): React.JSX.Element | null {
|
||||
const mainState = useGameStore((state) => state.mainState);
|
||||
const bikeStep = useGameStore((state) => state.bike.currentStep);
|
||||
const setMissionStep = useGameStore((state) => state.setMissionStep);
|
||||
|
||||
if (mainState !== "bike" || bikeStep !== "locked") return null;
|
||||
|
||||
return (
|
||||
<group position={EBIKE_REPAIR_POSITION}>
|
||||
<InteractableObject
|
||||
kind="trigger"
|
||||
label="Réparer l'e-bike"
|
||||
position={EBIKE_REPAIR_POSITION}
|
||||
radius={4}
|
||||
onPress={() => setMissionStep("bike", "waiting")}
|
||||
>
|
||||
<mesh>
|
||||
<sphereGeometry args={[1.3, 16, 16]} />
|
||||
<meshBasicMaterial transparent opacity={0} depthWrite={false} />
|
||||
</mesh>
|
||||
</InteractableObject>
|
||||
</group>
|
||||
);
|
||||
}
|
||||
|
||||
export function GameStageContent(): React.JSX.Element {
|
||||
const mainState = useGameStore((state) => state.mainState);
|
||||
|
||||
@@ -63,6 +90,7 @@ export function GameStageContent(): React.JSX.Element {
|
||||
position={zone.position}
|
||||
/>
|
||||
))}
|
||||
<EbikeMissionTrigger />
|
||||
{mainState === "outro" ? (
|
||||
<StageAnchor color="#fb7185" position={[0, 6, 10]} scale={1.25} />
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user