diff options
-rw-r--r-- | scripts/toy.groovy | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 1d8aa03..d1bd099 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -60,26 +60,12 @@ return new Object() { .sum() }; def loadModules = { toy -> - final postLoad = [:]; new File("$DATAFOLDER/scripts/toy") .listFiles() - .each({s -> - if (stateIs("DEBUG")) { - show("Loading ${s.name}..."); - } - postLoad[s.name] = Eval.me(s.text)(toy); - }); - postLoad - .findAll { s, p -> p } - .each { s, p -> - if (stateIs("DEBUG")) { - show("Post load $s..."); - } - p(); - }; - if (stateIs("DEBUG")) { - show("All modules loaded"); + .collect { s -> + Eval.me(s.text)(toy); } + .findAll { }; }; // Utils @@ -340,7 +326,7 @@ return new Object() { setDefault("toy.owner", "ancilla"); OWNER = loadString("toy.owner"); loadDomme(OWNER); - loadModules(this); + def moduleSetup = loadModules(this); def getDayNum = { Math.floorDiv(getTime() - localTimeOffset() - 14400, 86400) }; def getAvail = { dayNum -> loadInteger("toy.availability.$dayNum") ?: 0 }; def addAvail = { amount -> @@ -362,6 +348,7 @@ return new Object() { setDefault("toy.punishment", 0); execEvents(false); tidyAvail(); + moduleSetup.each { p -> p() }; final cycleTime = 60; showLounge(); |