Modify RuntimeInteractionSystem test to include full dialogue structure and update startDialogue to startNpcDialogue

This commit is contained in:
2026-04-15 09:26:56 +02:00
parent 0ee6129d0c
commit 50809a0392

View File

@@ -191,6 +191,7 @@ function createDispatcher(
stopAnimation: () => {}, stopAnimation: () => {},
playSound: () => {}, playSound: () => {},
stopSound: () => {}, stopSound: () => {},
startNpcDialogue: () => {},
startDialogue: () => {}, startDialogue: () => {},
...overrides ...overrides
}; };
@@ -918,7 +919,20 @@ describe("RuntimeInteractionSystem", () => {
}, },
yawDegrees: 180, yawDegrees: 180,
modelAssetId: null, modelAssetId: null,
dialogueId: "dialogue-merchant", dialogues: [
{
id: "dialogue-merchant",
title: "Merchant Greeting",
lines: [
{
id: "dialogue-merchant-line-1",
speakerName: "Merchant",
text: "Fresh goods."
}
]
}
],
defaultDialogueId: "dialogue-merchant",
collider: { collider: {
mode: "capsule", mode: "capsule",
radius: 0.3, radius: 0.3,
@@ -964,16 +978,16 @@ describe("RuntimeInteractionSystem", () => {
"entity-npc-merchant", "entity-npc-merchant",
runtimeScene, runtimeScene,
createDispatcher({ createDispatcher({
startDialogue: (dialogueId, source) => { startNpcDialogue: (npcEntityId, dialogueId, source) => {
dispatches.push( dispatches.push(
`${source?.kind}:${source?.sourceEntityId}:${source?.trigger}:${dialogueId}` `${source?.kind}:${source?.sourceEntityId}:${source?.trigger}:${npcEntityId}:${dialogueId}`
); );
} }
}) })
); );
expect(dispatches).toEqual([ expect(dispatches).toEqual([
"npc:entity-npc-merchant:click:dialogue-merchant" "npc:entity-npc-merchant:click:entity-npc-merchant:dialogue-merchant"
]); ]);
}); });