Validate NPC target anchor structure, mode, and offset

This commit is contained in:
2026-05-11 21:55:38 +02:00
parent f26f246c8a
commit 8b9d2af28f

View File

@@ -4985,6 +4985,42 @@ function validateNpcEntity(
);
}
if (
typeof entity.targetAnchor !== "object" ||
entity.targetAnchor === null
) {
diagnostics.push(
createDiagnostic(
"error",
"invalid-npc-target-anchor",
"NPC target anchor must remain an object.",
`${path}.targetAnchor`
)
);
} else {
if (!isNpcTargetAnchorMode(entity.targetAnchor.mode)) {
diagnostics.push(
createDiagnostic(
"error",
"invalid-npc-target-anchor-mode",
"NPC target anchor mode must be center, eyeHeight, top, origin, or custom.",
`${path}.targetAnchor.mode`
)
);
}
if (!isFiniteVec3(entity.targetAnchor.offset)) {
diagnostics.push(
createDiagnostic(
"error",
"invalid-npc-target-anchor-offset",
"NPC target anchor offset must remain finite on every axis.",
`${path}.targetAnchor.offset`
)
);
}
}
validateNpcModelAssetId(entity, path, document, diagnostics);
const seenNpcDialogueIds = new Map<string, string>();