Refactor: Export and consolidate NPC synchronization functions
This commit is contained in:
@@ -165,13 +165,17 @@ function createNpcChange(
|
|||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshRuntimeNpcEntities(runtimeScene: RuntimeSceneDefinition): void {
|
export function refreshRuntimeNpcEntities(
|
||||||
|
runtimeScene: RuntimeSceneDefinition
|
||||||
|
): void {
|
||||||
runtimeScene.entities.npcs = runtimeScene.npcDefinitions
|
runtimeScene.entities.npcs = runtimeScene.npcDefinitions
|
||||||
.filter((npc) => npc.active)
|
.filter((npc) => npc.active)
|
||||||
.map((npc) => createRuntimeNpcFromDefinition(npc));
|
.map((npc) => createRuntimeNpcFromDefinition(npc));
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshRuntimeNpcColliders(runtimeScene: RuntimeSceneDefinition): void {
|
export function refreshRuntimeNpcColliders(
|
||||||
|
runtimeScene: RuntimeSceneDefinition
|
||||||
|
): void {
|
||||||
runtimeScene.colliders = [
|
runtimeScene.colliders = [
|
||||||
...runtimeScene.staticColliders,
|
...runtimeScene.staticColliders,
|
||||||
...runtimeScene.entities.npcs
|
...runtimeScene.entities.npcs
|
||||||
@@ -180,6 +184,13 @@ function refreshRuntimeNpcColliders(runtimeScene: RuntimeSceneDefinition): void
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function refreshRuntimeNpcCollections(
|
||||||
|
runtimeScene: RuntimeSceneDefinition
|
||||||
|
): void {
|
||||||
|
refreshRuntimeNpcEntities(runtimeScene);
|
||||||
|
refreshRuntimeNpcColliders(runtimeScene);
|
||||||
|
}
|
||||||
|
|
||||||
export function createRuntimeScheduleSyncContext(
|
export function createRuntimeScheduleSyncContext(
|
||||||
runtimeScene: RuntimeSceneDefinition
|
runtimeScene: RuntimeSceneDefinition
|
||||||
): RuntimeScheduleSyncContext {
|
): RuntimeScheduleSyncContext {
|
||||||
|
|||||||
Reference in New Issue
Block a user