diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index af7686a9..1033a205 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -282,6 +282,7 @@ export class RuntimeHost { null; private currentInteractionPrompt: RuntimeInteractionPrompt | null = null; private currentDialogue: RuntimeDialogueState | null = null; + private suppressNextDialogueAdvanceClick = false; private currentSceneLoadState: RuntimeSceneLoadState | null = null; private currentClockState: RuntimeClockState | null = null; private lastPublishedClockState: RuntimeClockState | null = null; @@ -487,6 +488,7 @@ export class RuntimeHost { this.interactionSystem.reset(); this.setInteractionPrompt(null); this.setRuntimeDialogue(null); + this.suppressNextDialogueAdvanceClick = false; this.currentPlayerControllerTelemetry = null; this.currentPlayerAudioHooks = null; this.playerControllerTelemetryHandler?.(null); @@ -599,6 +601,7 @@ export class RuntimeHost { const nextLineIndex = this.currentDialogue.lineIndex + 1; if (nextLineIndex >= dialogue.lines.length) { + this.suppressNextDialogueAdvanceClick = false; this.setRuntimeDialogue(null); return; } @@ -613,6 +616,7 @@ export class RuntimeHost { } closeRuntimeDialogue() { + this.suppressNextDialogueAdvanceClick = false; this.setRuntimeDialogue(null); } @@ -3081,7 +3085,8 @@ export class RuntimeHost { this.currentDialogue?.source.kind === dialogue?.source.kind && this.currentDialogue?.source.sourceEntityId === dialogue?.source.sourceEntityId && - this.currentDialogue?.source.linkId === dialogue?.source.linkId + this.currentDialogue?.source.linkId === dialogue?.source.linkId && + this.currentDialogue?.source.trigger === dialogue?.source.trigger ) { return; } @@ -3095,7 +3100,8 @@ export class RuntimeHost { source: RuntimeDialogueStartSource = { kind: "direct", sourceEntityId: null, - linkId: null + linkId: null, + trigger: null } ) { if (this.currentDialogue?.dialogueId === dialogueId) { @@ -3109,6 +3115,8 @@ export class RuntimeHost { return; } + this.suppressNextDialogueAdvanceClick = + source.trigger === "enter" || source.trigger === "exit"; this.setRuntimeDialogue(dialogue); } @@ -3159,6 +3167,11 @@ export class RuntimeHost { this.audioSystem.handleUserGesture(); if (this.currentDialogue !== null) { + if (this.suppressNextDialogueAdvanceClick) { + this.suppressNextDialogueAdvanceClick = false; + return; + } + this.advanceRuntimeDialogue(); return; }