From bf84a2f62a4e22b613f5afc9fb84d4c66a69276f Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 14 Apr 2026 01:55:55 +0200 Subject: [PATCH] Refactor validateProjectScheduler to accept options object and improve validation logic --- src/document/scene-document-validation.ts | 28 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/document/scene-document-validation.ts b/src/document/scene-document-validation.ts index bcf1cc8b..76670395 100644 --- a/src/document/scene-document-validation.ts +++ b/src/document/scene-document-validation.ts @@ -3398,9 +3398,11 @@ function validateInteractionLink( } } -function validateProjectSchedulerAgainstScene( +function validateProjectScheduler( scheduler: ProjectScheduler, - document: SceneDocument, + options: { + actorExists(actorId: string): boolean; + }, diagnostics: SceneDiagnostic[] ) { for (const [routineKey, routine] of Object.entries(scheduler.routines)) { @@ -3449,7 +3451,16 @@ function validateProjectSchedulerAgainstScene( ) ); } else { - validateActorControlTarget(routine.target, `${path}.target`, document, diagnostics); + if (!options.actorExists(routine.target.actorId)) { + diagnostics.push( + createDiagnostic( + "error", + "missing-control-actor-target", + `Actor control target ${routine.target.actorId} does not exist in this document.`, + `${path}.target.actorId` + ) + ); + } } switch (routine.days.mode) { @@ -3584,7 +3595,16 @@ function validateProjectSchedulerAgainstScene( ); } - validateControlEffect(routine.effect, `${path}.effect`, document, diagnostics); + if (!isBoolean(routine.effect.active)) { + diagnostics.push( + createDiagnostic( + "error", + "invalid-control-actor-active", + "Actor presence control values must remain boolean.", + `${path}.effect.active` + ) + ); + } } }