Implementing storylet generators as generator functions

This commit is contained in:
David Masad
2021-02-06 07:05:00 -05:00
parent edd66e8da9
commit 82e7c5f403
9 changed files with 90 additions and 103 deletions

View File

@ -11,11 +11,11 @@ StoryManager.getAllStorylets = function(tag=null) {
storylet = this.storylets[key];
if (tag === null || ("tags" in storylet && storylet.tags.includes(tag))) {
// TODO: If using yield, this part will change
storylets = storylet.generate();
for (let i in storylets) {
boundStorylet = storylets[i];
//storylets = storylet.generate();
for (let boundStorylet of storylet.generate()) {
//boundStorylet = storylets[i];
if (!("priority" in boundStorylet)) boundStorylet.priority = 0;
allStorylets.push(storylets[i]);
allStorylets.push(boundStorylet);
}
}
}