95ca1bbfde
🔍 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
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import type { MapNode } from "@/types/map/mapScene";
|
|
import { VEGETATION_MAP_NODE_NAMES } from "@/data/world/vegetationConfig";
|
|
import { isInstancedMapNodeName } from "@/utils/map/isInstancedMapNodeName";
|
|
|
|
const MAP_STRUCTURE_NODE_NAMES = new Set(["Scene", "blocking", "terrain"]);
|
|
|
|
function isRuntimeStructureMapNode(name: string): boolean {
|
|
return MAP_STRUCTURE_NODE_NAMES.has(name);
|
|
}
|
|
|
|
export function isRuntimeSingleMapNode(node: MapNode): boolean {
|
|
if (isRuntimeStructureMapNode(node.name)) {
|
|
return false;
|
|
}
|
|
|
|
if (node.type === "Mesh") {
|
|
return false;
|
|
}
|
|
|
|
return (
|
|
!VEGETATION_MAP_NODE_NAMES.has(node.name) &&
|
|
!isInstancedMapNodeName(node.name)
|
|
);
|
|
}
|
|
|
|
export function isRuntimeCollisionMapNode(node: MapNode): boolean {
|
|
return node.name === "terrain" || isRuntimeSingleMapNode(node);
|
|
}
|
|
|
|
export function isEditorVisibleMapNode(node: MapNode): boolean {
|
|
return !isRuntimeStructureMapNode(node.name) && node.type !== "Mesh";
|
|
}
|
|
|
|
export function getTerrainMapNode(nodes: readonly MapNode[]): MapNode | null {
|
|
return nodes.find((node) => node.name === "terrain") ?? null;
|
|
}
|