Add dialogue interaction link and update test fixture

This commit is contained in:
2026-04-14 20:00:22 +02:00
parent 57a03dcfd4
commit aa84bdff22

View File

@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { createEmptyRuntimeControlSurfaceDefinition } from "../../src/controls/control-surface"; import { createEmptyRuntimeControlSurfaceDefinition } from "../../src/controls/control-surface";
import { createEmptyProjectDialogueLibrary } from "../../src/dialogues/project-dialogues";
import { import {
createPlayerStartInputBindings, createPlayerStartInputBindings,
createPlayerStartMovementTemplate createPlayerStartMovementTemplate
@@ -8,6 +9,7 @@ import {
import { import {
createPlayAnimationInteractionLink, createPlayAnimationInteractionLink,
createPlaySoundInteractionLink, createPlaySoundInteractionLink,
createStartDialogueInteractionLink,
createTeleportPlayerInteractionLink, createTeleportPlayerInteractionLink,
createToggleVisibilityInteractionLink, createToggleVisibilityInteractionLink,
createStopAnimationInteractionLink, createStopAnimationInteractionLink,
@@ -19,6 +21,7 @@ import { createEmptyProjectScheduler } from "../../src/scheduler/project-schedul
import { RuntimeInteractionSystem } from "../../src/runtime-three/runtime-interaction-system"; import { RuntimeInteractionSystem } from "../../src/runtime-three/runtime-interaction-system";
import { createRuntimeProjectSchedulerState } from "../../src/runtime-three/runtime-project-scheduler"; import { createRuntimeProjectSchedulerState } from "../../src/runtime-three/runtime-project-scheduler";
import type { RuntimeSceneDefinition } from "../../src/runtime-three/runtime-scene-build"; import type { RuntimeSceneDefinition } from "../../src/runtime-three/runtime-scene-build";
import type { RuntimeInteractionDispatcher } from "../../src/runtime-three/runtime-interaction-system";
function createRuntimeSceneFixture(): RuntimeSceneDefinition { function createRuntimeSceneFixture(): RuntimeSceneDefinition {
const movementTemplate = createPlayerStartMovementTemplate(); const movementTemplate = createPlayerStartMovementTemplate();
@@ -28,6 +31,7 @@ function createRuntimeSceneFixture(): RuntimeSceneDefinition {
scheduler: createRuntimeProjectSchedulerState({ scheduler: createRuntimeProjectSchedulerState({
document: createEmptyProjectScheduler() document: createEmptyProjectScheduler()
}), }),
dialogues: createEmptyProjectDialogueLibrary(),
world: { world: {
...createDefaultWorldSettings(), ...createDefaultWorldSettings(),
background: { background: {
@@ -171,6 +175,22 @@ function createRuntimeSceneFixture(): RuntimeSceneDefinition {
}; };
} }
function createDispatcher(
overrides: Partial<RuntimeInteractionDispatcher> = {}
): RuntimeInteractionDispatcher {
return {
teleportPlayer: () => {},
activateSceneExit: () => {},
toggleBrushVisibility: () => {},
playAnimation: () => {},
stopAnimation: () => {},
playSound: () => {},
stopSound: () => {},
startDialogue: () => {},
...overrides
};
}
describe("RuntimeInteractionSystem", () => { describe("RuntimeInteractionSystem", () => {
it("dispatches teleport player on Trigger Volume enter", () => { it("dispatches teleport player on Trigger Volume enter", () => {
const runtimeScene = createRuntimeSceneFixture(); const runtimeScene = createRuntimeSceneFixture();