From 01226eb92d19af88d7d8ccd6d698eca06a76259e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 16 Jun 2019 17:09:04 +0100 Subject: Load modules from the scripts/toy folder --- scripts/toy.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 50661f8..1dfadca 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -93,6 +93,13 @@ return new Object() { .collect { readDomme(it) } .sum() }; + def loadModules = { toy -> + new File("$DATAFOLDER/scripts/toy") + .listFiles() + .every({s -> + Eval.me(s.text)(toy); + }); + }; def selectImage = { domme, set, spec -> def meets = { i -> return spec.every({ s -> @@ -1965,6 +1972,7 @@ return new Object() { setDefault("toy.owner", "ancilla"); OWNER = loadString("toy.owner"); DOMME = loadDomme(OWNER); + loadModules(this); def getDayNum = { Math.floorDiv(getTime() - localTimeOffset() - 14400, 86400) }; def getAvail = { dayNum -> loadInteger("toy.availability.$dayNum") ?: 0 }; def addAvail = { amount -> -- cgit v1.2.3