Skip to content

Commit

Permalink
fix: do not add sections twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Echsecutor committed Nov 14, 2024
1 parent 2facdaa commit a487f59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions commons/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit a487f59

Please sign in to comment.