Implement 'startDialogue' interaction link handling and update dialogue link target
This commit is contained in:
@@ -7127,6 +7127,14 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
targetSoundEmitterId: link.action.targetSoundEmitterId
|
targetSoundEmitterId: link.action.targetSoundEmitterId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "startDialogue":
|
||||||
|
nextLink = createStartDialogueInteractionLink({
|
||||||
|
id: link.id,
|
||||||
|
sourceEntityId: link.sourceEntityId,
|
||||||
|
trigger,
|
||||||
|
dialogueId: link.action.dialogueId
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "control":
|
case "control":
|
||||||
nextLink = createControlInteractionLink({
|
nextLink = createControlInteractionLink({
|
||||||
id: link.id,
|
id: link.id,
|
||||||
@@ -7161,6 +7169,29 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actionType === "startDialogue") {
|
||||||
|
const defaultDialogue = projectDialogueList[0] ?? null;
|
||||||
|
|
||||||
|
if (defaultDialogue === null) {
|
||||||
|
setStatusMessage(
|
||||||
|
"Author a project dialogue before switching this link to dialogue."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
commitInteractionLinkChange(
|
||||||
|
link,
|
||||||
|
createStartDialogueInteractionLink({
|
||||||
|
id: link.id,
|
||||||
|
sourceEntityId: sourceEntity.id,
|
||||||
|
trigger: link.trigger,
|
||||||
|
dialogueId: defaultDialogue.id
|
||||||
|
}),
|
||||||
|
"Switched link action to start dialogue."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (actionType === "teleportPlayer") {
|
if (actionType === "teleportPlayer") {
|
||||||
const defaultTarget = teleportTargetOptions[0]?.entity;
|
const defaultTarget = teleportTargetOptions[0]?.entity;
|
||||||
|
|
||||||
@@ -7319,6 +7350,26 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateDialogueInteractionLinkTarget = (
|
||||||
|
link: InteractionLink,
|
||||||
|
dialogueId: string
|
||||||
|
) => {
|
||||||
|
if (link.action.type !== "startDialogue") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
commitInteractionLinkChange(
|
||||||
|
link,
|
||||||
|
createStartDialogueInteractionLink({
|
||||||
|
id: link.id,
|
||||||
|
sourceEntityId: link.sourceEntityId,
|
||||||
|
trigger: link.trigger,
|
||||||
|
dialogueId
|
||||||
|
}),
|
||||||
|
"Updated dialogue link target."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const updateTeleportInteractionLinkTarget = (
|
const updateTeleportInteractionLinkTarget = (
|
||||||
link: InteractionLink,
|
link: InteractionLink,
|
||||||
targetEntityId: string
|
targetEntityId: string
|
||||||
|
|||||||
Reference in New Issue
Block a user