From f87d948109d30b801df33c6036198f3d665cb4b0 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 11 May 2026 21:23:20 +0200 Subject: [PATCH] Add validation and runtime support for NPC targetable property --- src/document/scene-document-validation.ts | 12 ++++++++++++ src/runtime-three/runtime-scene-build.ts | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/document/scene-document-validation.ts b/src/document/scene-document-validation.ts index b38601ec..a7c522ca 100644 --- a/src/document/scene-document-validation.ts +++ b/src/document/scene-document-validation.ts @@ -4972,6 +4972,18 @@ function validateNpcEntity( } validateNpcPresence(entity.presence, `${path}.presence`, diagnostics); + + if (typeof entity.targetable !== "boolean") { + diagnostics.push( + createDiagnostic( + "error", + "invalid-npc-targetable", + "NPC targetable must remain a boolean.", + `${path}.targetable` + ) + ); + } + validateNpcModelAssetId(entity, path, document, diagnostics); const seenNpcDialogueIds = new Map(); diff --git a/src/runtime-three/runtime-scene-build.ts b/src/runtime-three/runtime-scene-build.ts index fe91466b..cb06da0f 100644 --- a/src/runtime-three/runtime-scene-build.ts +++ b/src/runtime-three/runtime-scene-build.ts @@ -375,6 +375,7 @@ export interface RuntimeNpc { actorId: string; name?: string; visible: boolean; + targetable: boolean; position: Vec3; yawDegrees: number; scale: Vec3; @@ -663,6 +664,7 @@ export function createRuntimeNpcFromDefinition( actorId: npc.actorId, name: npc.name, visible: npc.visible, + targetable: npc.targetable, position: cloneVec3(npc.position), yawDegrees: npc.yawDegrees, scale: cloneVec3(npc.scale), @@ -1742,6 +1744,7 @@ function buildRuntimeSceneCollections( actorId: entity.actorId, name: entity.name, visible: entity.visible, + targetable: entity.targetable, position: cloneVec3(entity.position), active: true, activeRoutineId: null,