summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-06-16 17:09:04 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-06-19 20:05:39 +0100
commit01226eb92d19af88d7d8ccd6d698eca06a76259e (patch)
tree5a4f5d3eeb36020da821b03b9655a82d2cbe364e /scripts
parentCount disappointments (diff)
downloadtoy-01226eb92d19af88d7d8ccd6d698eca06a76259e.zip
Load modules from the scripts/toy folder
Diffstat (limited to 'scripts')
-rw-r--r--scripts/toy.groovy8
1 files changed, 8 insertions, 0 deletions
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 ->