Add validation for undefined NPC presence in scene document
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user