Skip to content
Snippets Groups Projects
Commit dc7295dd authored by Jonas Zohren's avatar Jonas Zohren :speech_balloon:
Browse files

Collect all facts in dialogSet for debugger

parent 6eaa605b
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,23 @@
$: dialogNames = Object.keys(dialogSet.dialogs)
export let selectedDialogName: string
/**
* Collect all facts referenced in these dialogs
*/
function getDialogFacts(dialogMap: DialogMap): String[] {
const dialogs = [];
const dialogs: Dialog[] = [];
for (const dmKey of Object.keys(dialogMap)) dialogs.push(dialogMap[dmKey]);
return dialogs.map(dialog => [...(dialog.addFacts || []), ...(dialog.removeFacts || [])]).flat()
const allFacts = dialogs
.map((dialog) => [
...(dialog.addFacts || []),
...(dialog.removeFacts || []),
...dialog.options.map((opt) => opt.requiredFacts).flat(),
...dialog.options.map((opt) => opt.forbiddenFacts).flat(),
])
.flat();
// Deduplicate entries
const factsSet = new Set(allFacts);
return [...factsSet];
}
let seenFactIds = new Set<String>([...$gameFactsStore, ...getDialogFacts(dialogSet.dialogs)]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment