Add support for startDialogue action in runtime scene build and tests
This commit is contained in:
@@ -1596,6 +1596,8 @@ export function buildRuntimeSceneFromDocument(
|
|||||||
case "playSound":
|
case "playSound":
|
||||||
case "stopSound":
|
case "stopSound":
|
||||||
return enabledEntityIds.has(link.action.targetSoundEmitterId);
|
return enabledEntityIds.has(link.action.targetSoundEmitterId);
|
||||||
|
case "startDialogue":
|
||||||
|
return document.dialogues.dialogues[link.action.dialogueId] !== undefined;
|
||||||
case "control":
|
case "control":
|
||||||
switch (link.action.effect.target.kind) {
|
switch (link.action.effect.target.kind) {
|
||||||
case "entity":
|
case "entity":
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ import {
|
|||||||
createTeleportTargetEntity,
|
createTeleportTargetEntity,
|
||||||
createTriggerVolumeEntity
|
createTriggerVolumeEntity
|
||||||
} from "../../src/entities/entity-instances";
|
} from "../../src/entities/entity-instances";
|
||||||
import { createTeleportPlayerInteractionLink, createToggleVisibilityInteractionLink } from "../../src/interactions/interaction-links";
|
import {
|
||||||
|
createStartDialogueInteractionLink,
|
||||||
|
createTeleportPlayerInteractionLink,
|
||||||
|
createToggleVisibilityInteractionLink
|
||||||
|
} from "../../src/interactions/interaction-links";
|
||||||
import { createProjectScheduleRoutine } from "../../src/scheduler/project-scheduler";
|
import { createProjectScheduleRoutine } from "../../src/scheduler/project-scheduler";
|
||||||
import { createModelInstance } from "../../src/assets/model-instances";
|
import { createModelInstance } from "../../src/assets/model-instances";
|
||||||
import { createProjectAssetStorageKey, type AudioAssetRecord } from "../../src/assets/project-assets";
|
import { createProjectAssetStorageKey, type AudioAssetRecord } from "../../src/assets/project-assets";
|
||||||
@@ -339,9 +343,32 @@ describe("buildRuntimeSceneFromDocument", () => {
|
|||||||
sourceEntityId: interactable.id,
|
sourceEntityId: interactable.id,
|
||||||
trigger: "click",
|
trigger: "click",
|
||||||
targetEntityId: teleportTarget.id
|
targetEntityId: teleportTarget.id
|
||||||
|
}),
|
||||||
|
"link-interactable-dialogue": createStartDialogueInteractionLink({
|
||||||
|
id: "link-interactable-dialogue",
|
||||||
|
sourceEntityId: interactable.id,
|
||||||
|
trigger: "click",
|
||||||
|
dialogueId: "dialogue-warning"
|
||||||
|
}),
|
||||||
|
"link-trigger-dialogue": createStartDialogueInteractionLink({
|
||||||
|
id: "link-trigger-dialogue",
|
||||||
|
sourceEntityId: triggerVolume.id,
|
||||||
|
trigger: "enter",
|
||||||
|
dialogueId: "dialogue-warning"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
document.dialogues.dialogues["dialogue-warning"] = {
|
||||||
|
id: "dialogue-warning",
|
||||||
|
title: "Warning",
|
||||||
|
lines: [
|
||||||
|
{
|
||||||
|
id: "dialogue-line-warning-1",
|
||||||
|
speakerName: "Operator",
|
||||||
|
text: "The generator is unstable."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
document.world.background = {
|
document.world.background = {
|
||||||
mode: "image",
|
mode: "image",
|
||||||
assetId: imageAsset.id,
|
assetId: imageAsset.id,
|
||||||
@@ -725,6 +752,15 @@ describe("buildRuntimeSceneFromDocument", () => {
|
|||||||
targetEntityId: "entity-teleport-target-main"
|
targetEntityId: "entity-teleport-target-main"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "link-interactable-dialogue",
|
||||||
|
sourceEntityId: "entity-interactable-console",
|
||||||
|
trigger: "click",
|
||||||
|
action: {
|
||||||
|
type: "startDialogue",
|
||||||
|
dialogueId: "dialogue-warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "link-teleport",
|
id: "link-teleport",
|
||||||
sourceEntityId: "entity-trigger-door",
|
sourceEntityId: "entity-trigger-door",
|
||||||
@@ -743,6 +779,15 @@ describe("buildRuntimeSceneFromDocument", () => {
|
|||||||
targetBrushId: "brush-room-floor",
|
targetBrushId: "brush-room-floor",
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "link-trigger-dialogue",
|
||||||
|
sourceEntityId: "entity-trigger-door",
|
||||||
|
trigger: "enter",
|
||||||
|
action: {
|
||||||
|
type: "startDialogue",
|
||||||
|
dialogueId: "dialogue-warning"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
expect(runtimeScene.playerStart).toEqual({
|
expect(runtimeScene.playerStart).toEqual({
|
||||||
|
|||||||
Reference in New Issue
Block a user