Refactor and update project schedule routines and options

This commit is contained in:
2026-04-14 03:06:48 +02:00
parent 90acccb10c
commit 915ff68aff
3 changed files with 13 additions and 7 deletions

View File

@@ -348,8 +348,7 @@ import {
getProjectScheduleEffectOptionId, getProjectScheduleEffectOptionId,
getProjectScheduleTargetOptionByKey, getProjectScheduleTargetOptionByKey,
listProjectScheduleEffectOptions, listProjectScheduleEffectOptions,
listProjectScheduleTargetOptions, listProjectScheduleTargetOptions
type ProjectScheduleEffectOptionId
} from "../scheduler/project-schedule-control-options"; } from "../scheduler/project-schedule-control-options";
import { import {
loadProjectPackage, loadProjectPackage,

View File

@@ -20,6 +20,14 @@ import {
type ProjectScheduleRoutine type ProjectScheduleRoutine
} from "../scheduler/project-scheduler"; } from "../scheduler/project-scheduler";
type ActorPresenceScheduleRoutine = ProjectScheduleRoutine & {
target: {
kind: "actor";
actorId: string;
};
effect: SetActorPresenceControlEffect;
};
export interface RuntimeResolvedActorScheduleState { export interface RuntimeResolvedActorScheduleState {
actorId: string; actorId: string;
hasRules: boolean; hasRules: boolean;
@@ -97,10 +105,10 @@ export function createRuntimeProjectSchedulerState(options: {
function resolveActorScheduleRules( function resolveActorScheduleRules(
scheduler: ProjectScheduler, scheduler: ProjectScheduler,
actorId: string actorId: string
): ProjectScheduleRoutine[] { ): ActorPresenceScheduleRoutine[] {
return Object.values(scheduler.routines) return Object.values(scheduler.routines)
.filter( .filter(
(routine) => (routine): routine is ActorPresenceScheduleRoutine =>
routine.enabled && routine.enabled &&
routine.target.kind === "actor" && routine.target.kind === "actor" &&
routine.target.actorId === actorId && routine.target.actorId === actorId &&

View File

@@ -28,7 +28,7 @@ import {
} from "../controls/control-surface"; } from "../controls/control-surface";
import { getModelInstances } from "../assets/model-instances"; import { getModelInstances } from "../assets/model-instances";
import { getModelInstanceDisplayLabel } from "../assets/model-instance-labels"; import { getModelInstanceDisplayLabel } from "../assets/model-instance-labels";
import { getEntityDisplayLabel, getSortedEntityDisplayLabels } from "../entities/entity-labels"; import { getSortedEntityDisplayLabels } from "../entities/entity-labels";
import { listProjectNpcActors } from "../entities/npc-actor-registry"; import { listProjectNpcActors } from "../entities/npc-actor-registry";
export const PROJECT_SCHEDULE_EFFECT_OPTION_IDS = [ export const PROJECT_SCHEDULE_EFFECT_OPTION_IDS = [
@@ -311,7 +311,7 @@ export function listProjectScheduleTargetOptions(
groupLabel: "Model Instances", groupLabel: "Model Instances",
defaults: { defaults: {
animationClipNames, animationClipNames,
animationLoop: modelInstance.animationLoop ?? true animationLoop: true
} }
}); });
} }
@@ -690,4 +690,3 @@ export function createProjectScheduleEffectFromOption(options: {
}); });
} }
} }