From a487f59d40c23f6f7556eccab92e6e64c0d1b2e6 Mon Sep 17 00:00:00 2001 From: Sebastian Schmittner Date: Thu, 14 Nov 2024 21:31:57 +0100 Subject: [PATCH] fix: do not add sections twice --- commons/common.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commons/common.js b/commons/common.js index 27492ca..a22e513 100644 --- a/commons/common.js +++ b/commons/common.js @@ -38,6 +38,12 @@ export const supported_actions = { if (!story.sections[story.state.current_section].next) { story.sections[story.state.current_section].next = []; } + for (const choice of story.sections[story.state.current_section].next) { + if (choice?.next == parameters[1] && choice?.text == parameters[2]) { + // choice already exists + return; + } + } story.sections[story.state.current_section].next.push({ text: parameters[2], next: parameters[1],