This commit is contained in:
2026-09-28 20:58:29 +08:00
parent c3e83a700a
commit 8045e3c63f
49 changed files with 4582 additions and 441 deletions
+13
View File
@@ -0,0 +1,13 @@
export const getAvailableStoryChoices = (run, content) => {
const flags = run.storyFlags || {};
return (content?.choices || []).filter(choice => {
return (choice.requires || []).every(flag => Boolean(flags[flag]))
&& (choice.excludes || []).every(flag => !flags[flag]);
});
};
export const applyStoryOutcome = (run, outcome = {}) => {
if (!run.storyFlags) run.storyFlags = {};
Object.assign(run.storyFlags, outcome.flags || {});
return outcome;
};