Refactor NPC entity creation in tests

This commit is contained in:
2026-04-15 10:01:50 +02:00
parent 8028b23924
commit 53aa43025f

View File

@@ -6,7 +6,6 @@ import {
createProjectSequence createProjectSequence
} from "../../src/sequencer/project-sequences"; } from "../../src/sequencer/project-sequences";
import { import {
createNpcEntity,
createPlayerStartInputBindings, createPlayerStartInputBindings,
createPlayerStartMovementTemplate createPlayerStartMovementTemplate
} from "../../src/entities/entity-instances"; } from "../../src/entities/entity-instances";
@@ -682,36 +681,13 @@ describe("RuntimeInteractionSystem", () => {
it("dispatches run-sequence links through authored impulse steps", () => { it("dispatches run-sequence links through authored impulse steps", () => {
const runtimeScene = createRuntimeSceneFixture(); const runtimeScene = createRuntimeSceneFixture();
runtimeScene.entities.npcs = [ runtimeScene.entities.npcs = [
{ createRuntimeNpcFixture({
...createNpcEntity({ entityId: "entity-npc-sequence",
id: "entity-npc-sequence", dialogueId: "dialogue-sequence",
dialogues: [
{
id: "dialogue-sequence",
title: "Sequence Dialogue", title: "Sequence Dialogue",
lines: [
{
id: "dialogue-line-sequence-1",
speakerName: "Console", speakerName: "Console",
text: "Sequence started." text: "Sequence started."
} })
]
}
],
defaultDialogueId: "dialogue-sequence"
}),
active: true,
activeRoutineId: null,
activeRoutineTitle: null,
authoredPosition: { x: 0, y: 0, z: 0 },
authoredYawDegrees: 0,
visible: true,
position: { x: 0, y: 0, z: 0 },
yawDegrees: 0,
animationClipName: null,
animationLoop: undefined,
resolvedPath: null
}
]; ];
runtimeScene.sequences.sequences["sequence-console-dialogue"] = runtimeScene.sequences.sequences["sequence-console-dialogue"] =
createProjectSequence({ createProjectSequence({
@@ -756,36 +732,13 @@ describe("RuntimeInteractionSystem", () => {
it("treats interactable sequence links as click interactions even when the stored trigger is non-click", () => { it("treats interactable sequence links as click interactions even when the stored trigger is non-click", () => {
const runtimeScene = createRuntimeSceneFixture(); const runtimeScene = createRuntimeSceneFixture();
runtimeScene.entities.npcs = [ runtimeScene.entities.npcs = [
{ createRuntimeNpcFixture({
...createNpcEntity({ entityId: "entity-npc-console",
id: "entity-npc-console", dialogueId: "dialogue-console",
dialogues: [
{
id: "dialogue-console",
title: "Console", title: "Console",
lines: [
{
id: "dialogue-line-console-1",
speakerName: "System", speakerName: "System",
text: "Console online." text: "Console online."
} })
]
}
],
defaultDialogueId: "dialogue-console"
}),
active: true,
activeRoutineId: null,
activeRoutineTitle: null,
authoredPosition: { x: 0, y: 0, z: 0 },
authoredYawDegrees: 0,
visible: true,
position: { x: 0, y: 0, z: 0 },
yawDegrees: 0,
animationClipName: null,
animationLoop: undefined,
resolvedPath: null
}
]; ];
runtimeScene.sequences.sequences["sequence-console-dialogue"] = runtimeScene.sequences.sequences["sequence-console-dialogue"] =
createProjectSequence({ createProjectSequence({
@@ -857,36 +810,12 @@ describe("RuntimeInteractionSystem", () => {
it("dispatches trigger-volume make-npc-talk sequences once on enter", () => { it("dispatches trigger-volume make-npc-talk sequences once on enter", () => {
const runtimeScene = createRuntimeSceneFixture(); const runtimeScene = createRuntimeSceneFixture();
runtimeScene.entities.npcs = [ runtimeScene.entities.npcs = [
{ createRuntimeNpcFixture({
...createNpcEntity({ entityId: "entity-npc-threshold",
id: "entity-npc-threshold", dialogueId: "dialogue-threshold",
dialogues: [
{
id: "dialogue-threshold",
title: "Threshold", title: "Threshold",
lines: [
{
id: "dialogue-line-threshold-1",
speakerName: null,
text: "You crossed the threshold." text: "You crossed the threshold."
} })
]
}
],
defaultDialogueId: "dialogue-threshold"
}),
active: true,
activeRoutineId: null,
activeRoutineTitle: null,
authoredPosition: { x: 0, y: 0, z: 0 },
authoredYawDegrees: 0,
visible: true,
position: { x: 0, y: 0, z: 0 },
yawDegrees: 0,
animationClipName: null,
animationLoop: undefined,
resolvedPath: null
}
]; ];
runtimeScene.sequences.sequences["sequence-trigger-dialogue"] = runtimeScene.sequences.sequences["sequence-trigger-dialogue"] =
createProjectSequence({ createProjectSequence({
@@ -948,36 +877,12 @@ describe("RuntimeInteractionSystem", () => {
it("treats trigger-volume sequence links authored with click as enter interactions", () => { it("treats trigger-volume sequence links authored with click as enter interactions", () => {
const runtimeScene = createRuntimeSceneFixture(); const runtimeScene = createRuntimeSceneFixture();
runtimeScene.entities.npcs = [ runtimeScene.entities.npcs = [
{ createRuntimeNpcFixture({
...createNpcEntity({ entityId: "entity-npc-threshold",
id: "entity-npc-threshold", dialogueId: "dialogue-threshold",
dialogues: [
{
id: "dialogue-threshold",
title: "Threshold", title: "Threshold",
lines: [
{
id: "dialogue-line-threshold-1",
speakerName: null,
text: "Welcome." text: "Welcome."
} })
]
}
],
defaultDialogueId: "dialogue-threshold"
}),
active: true,
activeRoutineId: null,
activeRoutineTitle: null,
authoredPosition: { x: 0, y: 0, z: 0 },
authoredYawDegrees: 0,
visible: true,
position: { x: 0, y: 0, z: 0 },
yawDegrees: 0,
animationClipName: null,
animationLoop: undefined,
resolvedPath: null
}
]; ];
runtimeScene.sequences.sequences["sequence-trigger-dialogue"] = runtimeScene.sequences.sequences["sequence-trigger-dialogue"] =
createProjectSequence({ createProjectSequence({
@@ -1053,36 +958,12 @@ describe("RuntimeInteractionSystem", () => {
}) })
]; ];
runtimeScene.entities.npcs = [ runtimeScene.entities.npcs = [
{ createRuntimeNpcFixture({
...createNpcEntity({ entityId: "entity-npc-threshold",
id: "entity-npc-threshold", dialogueId: "dialogue-threshold",
dialogues: [
{
id: "dialogue-threshold",
title: "Threshold", title: "Threshold",
lines: [
{
id: "dialogue-line-threshold-1",
speakerName: null,
text: "Welcome." text: "Welcome."
} })
]
}
],
defaultDialogueId: "dialogue-threshold"
}),
active: true,
activeRoutineId: null,
activeRoutineTitle: null,
authoredPosition: { x: 0, y: 0, z: 0 },
authoredYawDegrees: 0,
visible: true,
position: { x: 0, y: 0, z: 0 },
yawDegrees: 0,
animationClipName: null,
animationLoop: undefined,
resolvedPath: null
}
]; ];
runtimeScene.sequences.sequences["sequence-trigger-dialogue"] = runtimeScene.sequences.sequences["sequence-trigger-dialogue"] =
createProjectSequence({ createProjectSequence({