Add validation and runtime support for NPC targetable property

This commit is contained in:
2026-05-11 21:23:20 +02:00
parent 5d4e67de48
commit f87d948109
2 changed files with 15 additions and 0 deletions

View File

@@ -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<string, string>();

View File

@@ -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,