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
🔍 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:
@@ -2,7 +2,7 @@ import type {
|
||||
HierarchicalMapNode,
|
||||
MapNode,
|
||||
SceneData,
|
||||
} from "@/types/editor/editor";
|
||||
} from "@/types/map/mapScene";
|
||||
import { parseMapData } from "@/utils/map/mapNodeValidation";
|
||||
|
||||
const MAP_JSON_PATH = "/map.json";
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { MapNode } from "@/types/map/mapScene";
|
||||
import type { Vector3Tuple } from "@/types/three/three";
|
||||
|
||||
export interface MapNodeInstanceTransform {
|
||||
position: Vector3Tuple;
|
||||
rotation: Vector3Tuple;
|
||||
scale: Vector3Tuple;
|
||||
}
|
||||
|
||||
export function mapNodeToInstanceTransform(
|
||||
node: MapNode,
|
||||
): MapNodeInstanceTransform {
|
||||
return {
|
||||
position: node.position,
|
||||
rotation: node.rotation,
|
||||
scale: node.scale,
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { HierarchicalMapNode, MapNode } from "../../types/editor/editor";
|
||||
import type { HierarchicalMapNode, MapNode } from "@/types/map/mapScene";
|
||||
|
||||
export interface ParsedMapNodes {
|
||||
mapNodes: MapNode[];
|
||||
@@ -31,9 +31,7 @@ function isMapNode(value: unknown): value is MapNode {
|
||||
);
|
||||
}
|
||||
|
||||
export function isHierarchicalMapNode(
|
||||
value: unknown,
|
||||
): value is HierarchicalMapNode {
|
||||
function isHierarchicalMapNode(value: unknown): value is HierarchicalMapNode {
|
||||
if (!isMapNode(value)) {
|
||||
return false;
|
||||
}
|
||||
@@ -74,20 +72,6 @@ function flattenMapNode(node: HierarchicalMapNode, path: number[]): MapNode[] {
|
||||
return [mapNode, ...childNodes];
|
||||
}
|
||||
|
||||
export function parseHierarchicalMapPayload(
|
||||
value: unknown,
|
||||
): HierarchicalMapNode | HierarchicalMapNode[] {
|
||||
if (Array.isArray(value) && value.every(isHierarchicalMapNode)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (isHierarchicalMapNode(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
throw new Error("Invalid map node data");
|
||||
}
|
||||
|
||||
export function parseMapNodes(value: unknown): MapNode[] {
|
||||
return parseMapData(value).mapNodes;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MapNode } from "@/types/editor/editor";
|
||||
import { isInstancedMapNodeName } from "@/world/map-instancing/mapInstancingConfig";
|
||||
import type { MapNode } from "@/types/map/mapScene";
|
||||
import { isInstancedMapNodeName } from "@/data/world/mapInstancingConfig";
|
||||
|
||||
const MAP_STRUCTURE_NODE_NAMES = new Set(["Scene", "blocking", "terrain"]);
|
||||
const RUNTIME_VEGETATION_NODE_NAMES = new Set([
|
||||
@@ -11,7 +11,7 @@ const RUNTIME_VEGETATION_NODE_NAMES = new Set([
|
||||
"sapin",
|
||||
]);
|
||||
|
||||
export function isRuntimeStructureMapNode(name: string): boolean {
|
||||
function isRuntimeStructureMapNode(name: string): boolean {
|
||||
return MAP_STRUCTURE_NODE_NAMES.has(name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user