chore: address code quality audit findings
🔍 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:
Tom Boullay
2026-05-28 08:31:42 +02:00
parent 947025cbf5
commit d654565f87
73 changed files with 890 additions and 1457 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import type { SubtitleLanguage } from "@/managers/stores/useSettingsStore";
import type { SubtitleLanguage } from "@/types/settings/settings";
export type DialogueVoiceId = "narrateur" | "fermier" | "electricienne";
export type DialogueSpeaker = "Narrateur" | "Fermier" | "Electricienne";
+5 -21
View File
@@ -1,23 +1,7 @@
import type { Vector3Tuple } from "../three/three";
export interface MapNode {
name: string;
type: string;
position: Vector3Tuple;
rotation: Vector3Tuple;
scale: Vector3Tuple;
sourcePath?: number[];
}
export interface HierarchicalMapNode extends MapNode {
role?: "group";
children?: HierarchicalMapNode[];
}
export interface SceneData {
mapNodes: MapNode[];
models: Map<string, string>;
mapTree?: HierarchicalMapNode | HierarchicalMapNode[];
}
export type {
HierarchicalMapNode,
MapNode,
SceneData,
} from "@/types/map/mapScene";
export type TransformMode = "translate" | "rotate" | "scale";
+22
View File
@@ -25,6 +25,28 @@ export const GAME_STEPS: readonly GameStep[] = [
"outOfFabrik",
] as const;
const GAME_STEP_VALUES: ReadonlySet<string> = new Set(GAME_STEPS);
export type MainGameState = "intro" | "bike" | "pylone" | "ferme" | "outro";
export const MAIN_GAME_STATES: readonly MainGameState[] = [
"intro",
"bike",
"pylone",
"ferme",
"outro",
] as const;
const MAIN_GAME_STATE_VALUES: ReadonlySet<string> = new Set(MAIN_GAME_STATES);
export function isGameStep(value: unknown): value is GameStep {
return typeof value === "string" && GAME_STEP_VALUES.has(value);
}
export function isMainGameState(value: unknown): value is MainGameState {
return typeof value === "string" && MAIN_GAME_STATE_VALUES.has(value);
}
export interface Zone {
id: string;
position: Vector3Tuple;
+51 -3
View File
@@ -1,5 +1,49 @@
import type {
ModelTransformProps,
Vector3Scale,
Vector3Tuple,
} from "@/types/three/three";
export type RepairMissionId = "bike" | "pylone" | "ferme";
export interface RepairMissionCaseConfig {
position: Vector3Tuple;
rotation: Vector3Tuple;
scale: Vector3Scale;
}
export interface RepairMissionPartConfig {
id: string;
label: string;
nodeName?: string;
caseSlotName?: string;
modelPath?: string;
}
export interface RepairScannedBrokenPart {
id: string;
label: string;
modelPath: string;
caseSlotName?: string;
}
export interface RepairMissionConfig {
id: RepairMissionId;
label: string;
description: string;
modelPath: string;
modelScale?: ModelTransformProps["scale"];
stageUiPath: string;
interactUiPath: string;
brokenUiPath: string;
case: RepairMissionCaseConfig;
reassemblySeconds?: number;
requiredReplacementPartId: string;
scanPartSeconds?: number;
brokenParts: readonly RepairMissionPartConfig[];
replacementParts: readonly RepairMissionPartConfig[];
}
export type MissionStep =
| "locked"
| "waiting"
@@ -10,7 +54,10 @@ export type MissionStep =
| "reassembling"
| "done";
export const REPAIR_MISSION_IDS = ["bike", "pylone", "ferme"] as const;
const REPAIR_MISSION_IDS = ["bike", "pylone", "ferme"] as const;
const REPAIR_MISSION_ID_VALUES: ReadonlySet<string> = new Set(
REPAIR_MISSION_IDS,
);
export const MISSION_STEPS = [
"locked",
@@ -22,13 +69,14 @@ export const MISSION_STEPS = [
"reassembling",
"done",
] as const satisfies readonly MissionStep[];
const MISSION_STEP_VALUES: ReadonlySet<string> = new Set(MISSION_STEPS);
export function isRepairMissionId(value: string): value is RepairMissionId {
return (REPAIR_MISSION_IDS as readonly string[]).includes(value);
return REPAIR_MISSION_ID_VALUES.has(value);
}
export function isMissionStep(value: string): value is MissionStep {
return (MISSION_STEPS as readonly string[]).includes(value);
return MISSION_STEP_VALUES.has(value);
}
export function getNextMissionStep(step: MissionStep): MissionStep {
+21
View File
@@ -0,0 +1,21 @@
import type { Vector3Tuple } from "@/types/three/three";
export interface MapNode {
name: string;
type: string;
position: Vector3Tuple;
rotation: Vector3Tuple;
scale: Vector3Tuple;
sourcePath?: number[];
}
export interface HierarchicalMapNode extends MapNode {
role?: "group";
children?: HierarchicalMapNode[];
}
export interface SceneData {
mapNodes: MapNode[];
models: Map<string, string>;
mapTree?: HierarchicalMapNode | HierarchicalMapNode[];
}
+1
View File
@@ -0,0 +1 @@
export type SubtitleLanguage = "fr" | "en";
+1 -1
View File
@@ -1,4 +1,4 @@
export type SceneLoadingStatus = "loading" | "ready";
type SceneLoadingStatus = "loading" | "ready";
export interface SceneLoadingState {
currentStep: string;
+2 -28
View File
@@ -1,6 +1,4 @@
import type * as THREE from "three";
export type TerrainSurfaceKind =
type TerrainSurfaceKind =
| "grass"
| "path"
| "water"
@@ -8,12 +6,7 @@ export type TerrainSurfaceKind =
| "dirt"
| "rock";
export type TerrainSurfaceRgb = readonly [number, number, number];
export interface TerrainSurfaceUv {
u: number;
v: number;
}
type TerrainSurfaceRgb = readonly [number, number, number];
export interface TerrainSurfaceBounds {
minX: number;
@@ -22,13 +15,6 @@ export interface TerrainSurfaceBounds {
maxZ: number;
}
export interface TerrainSurfaceProjectionConfig {
flipX: boolean;
flipZ: boolean;
offsetX: number;
offsetZ: number;
}
export interface TerrainSurfaceColorConfig {
hex: string;
rgb: TerrainSurfaceRgb;
@@ -37,15 +23,3 @@ export interface TerrainSurfaceColorConfig {
modelPath?: string;
tileSize?: number;
}
export interface TerrainSurfaceSample {
rgb: TerrainSurfaceRgb;
key: string | null;
config: TerrainSurfaceColorConfig | null;
}
export interface TerrainSurfaceData {
bounds: TerrainSurfaceBounds;
imageData: ImageData;
raycastTarget: THREE.Object3D;
}