feat: ancre les réparations sur la map chargée

This commit is contained in:
tom-boullay
2026-05-28 15:47:53 +02:00
parent ba50224e6e
commit 9bbed06ddc
10 changed files with 150 additions and 19 deletions
+4 -7
View File
@@ -1,11 +1,8 @@
import type { Vector3Tuple } from "@/types/three/three";
import type { RepairMissionId } from "@/types/gameplay/repairMission";
export interface RepairMissionTriggerConfig {
mission: RepairMissionId;
label: string;
radius: number;
}
import type {
RepairMissionId,
RepairMissionTriggerConfig,
} from "@/types/gameplay/repairMission";
export const EBIKE_REPAIR_POSITION = [
42.2399, 4.5484, 34.6468,
+1 -1
View File
@@ -20,7 +20,7 @@ export const REPAIR_MISSIONS: Record<RepairMissionId, RepairMissionConfig> = {
description:
"Repair the damaged cooling module before relaunching the bike",
modelPath: "/models/ebike/model.gltf",
modelScale: 0.5,
modelScale: 0.3,
stageUiPath: "/assets/UI/ebike.webm",
interactUiPath: REPAIR_INTERACT_UI_PATH,
brokenUiPath: REPAIR_BROKEN_UI_PATH,
+37
View File
@@ -2,6 +2,7 @@ export const MAP_INSTANCING_ASSETS = {
boiteauxlettres: {
mapName: "boiteauxlettres",
modelPath: "/models/boiteauxlettres/model.gltf",
scaleMultiplier: 2,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -9,6 +10,7 @@ export const MAP_INSTANCING_ASSETS = {
pylone: {
mapName: "pylone",
modelPath: "/models/pylone/model.gltf",
scaleMultiplier: 1,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -16,6 +18,7 @@ export const MAP_INSTANCING_ASSETS = {
immeuble1: {
mapName: "immeuble1",
modelPath: "/models/immeuble1/model.gltf",
scaleMultiplier: 1,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -23,6 +26,7 @@ export const MAP_INSTANCING_ASSETS = {
maison1: {
mapName: "maison1",
modelPath: "/models/maison1/model.gltf",
scaleMultiplier: 3,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -30,6 +34,7 @@ export const MAP_INSTANCING_ASSETS = {
eolienne: {
mapName: "eolienne",
modelPath: "/models/eolienne/model.gltf",
scaleMultiplier: 0.85,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -37,6 +42,7 @@ export const MAP_INSTANCING_ASSETS = {
parcebike: {
mapName: "parcebike",
modelPath: "/models/parcebike/model.gltf",
scaleMultiplier: 2,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -44,6 +50,7 @@ export const MAP_INSTANCING_ASSETS = {
panneauaffichage: {
mapName: "panneauaffichage",
modelPath: "/models/panneauaffichage/model.gltf",
scaleMultiplier: 1,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -51,6 +58,7 @@ export const MAP_INSTANCING_ASSETS = {
panneauclassique: {
mapName: "panneauclassique",
modelPath: "/models/panneauclassique/model.gltf",
scaleMultiplier: 1,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -58,6 +66,7 @@ export const MAP_INSTANCING_ASSETS = {
panneaufleche: {
mapName: "panneaufleche",
modelPath: "/models/panneaufleche/model.gltf",
scaleMultiplier: 1,
castShadow: true,
receiveShadow: true,
enabled: true,
@@ -65,12 +74,40 @@ export const MAP_INSTANCING_ASSETS = {
panneausolaire: {
mapName: "panneausolaire",
modelPath: "/models/panneausolaire/model.gltf",
scaleMultiplier: 0.85,
castShadow: true,
receiveShadow: true,
enabled: true,
},
} as const;
export const MAP_SINGLE_MODEL_SCALE_MULTIPLIERS = {
ebike: 0.3,
} as const satisfies Record<string, number>;
export function getMapSingleModelScaleMultiplier(name: string): number {
return (
MAP_SINGLE_MODEL_SCALE_MULTIPLIERS[
name as keyof typeof MAP_SINGLE_MODEL_SCALE_MULTIPLIERS
] ?? 1
);
}
export function getMapInstancedModelScaleMultiplier(name: string): number {
return (
Object.values(MAP_INSTANCING_ASSETS).find(
(config) => config.mapName === name,
)?.scaleMultiplier ?? 1
);
}
export function getMapModelScaleMultiplier(name: string): number {
return (
getMapSingleModelScaleMultiplier(name) *
getMapInstancedModelScaleMultiplier(name)
);
}
export const MAP_INSTANCING_ASSET_TYPES = [
"boiteauxlettres",
"pylone",