Add validation for undefined NPC presence in scene document

This commit is contained in:
2026-04-13 23:48:32 +02:00
parent c3d164f149
commit e5b23e882c

View File

@@ -2633,10 +2633,27 @@ function validateNpcModelAssetId(
} }
function validateNpcPresence( function validateNpcPresence(
presence: NpcPresence, presence: NpcPresence | undefined,
path: string, path: string,
diagnostics: SceneDiagnostic[] diagnostics: SceneDiagnostic[]
) { ) {
if (
presence === undefined ||
typeof presence !== "object" ||
presence === null ||
!("mode" in presence)
) {
diagnostics.push(
createDiagnostic(
"error",
"missing-npc-presence",
"NPC presence must remain explicitly authored.",
path
)
);
return;
}
if (!isNpcPresenceMode(presence.mode)) { if (!isNpcPresenceMode(presence.mode)) {
diagnostics.push( diagnostics.push(
createDiagnostic( createDiagnostic(