From 607cb31facc1e1bf983dd5a6f19c1f916bc3ab78 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 24 Jun 2019 21:35:51 +0100 Subject: Support post load module callback for late setup --- scripts/toy.groovy | 16 ++++++++++++++-- scripts/toy/bondage.groovy | 1 + scripts/toy/cbt.groovy | 1 + scripts/toy/chastity.groovy | 1 + scripts/toy/confession.groovy | 1 + scripts/toy/debug.groovy | 1 + scripts/toy/humiliation.groovy | 1 + scripts/toy/imagery.groovy | 1 + scripts/toy/intro.groovy | 1 + scripts/toy/misc.groovy | 1 + scripts/toy/orgasmControl.groovy | 1 + scripts/toy/pain.groovy | 1 + scripts/toy/play.groovy | 1 + scripts/toy/sleep.groovy | 1 + scripts/toy/social.groovy | 1 + scripts/toy/tease.groovy | 1 + 16 files changed, 29 insertions(+), 2 deletions(-) diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 3a0d15a..1d8aa03 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -60,14 +60,26 @@ return new Object() { .sum() }; def loadModules = { toy -> + final postLoad = [:]; new File("$DATAFOLDER/scripts/toy") .listFiles() .each({s -> if (stateIs("DEBUG")) { - show("Loading $s..."); + show("Loading ${s.name}..."); } - Eval.me(s.text)(toy); + 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"); + } }; // Utils diff --git a/scripts/toy/bondage.groovy b/scripts/toy/bondage.groovy index 400d669..ad4678c 100644 --- a/scripts/toy/bondage.groovy +++ b/scripts/toy/bondage.groovy @@ -95,4 +95,5 @@ toy.addActivity("preGag", { toy.preGag() }); toy.addActivity("preCollar", { toy.preCollar() }); toy.addActivity("playBondage", { toy.playBondage() }); + return null; } diff --git a/scripts/toy/cbt.groovy b/scripts/toy/cbt.groovy index 459f602..9c0d28e 100644 --- a/scripts/toy/cbt.groovy +++ b/scripts/toy/cbt.groovy @@ -104,4 +104,5 @@ toy.addActivity("playBeatCock", { toy.playBeatCock() }); toy.addActivity("playBeatBalls", { toy.playBeatBalls() }); + return null; } diff --git a/scripts/toy/chastity.groovy b/scripts/toy/chastity.groovy index 5b0c298..8068425 100644 --- a/scripts/toy/chastity.groovy +++ b/scripts/toy/chastity.groovy @@ -109,4 +109,5 @@ toy.addActivity('preRelease', { toy.preRelease() }); toy.addActivity('preChastity', { toy.preChastity() }); toy.addActivity('postChastity', { toy.postChastity() }); + return null; } diff --git a/scripts/toy/confession.groovy b/scripts/toy/confession.groovy index 774fd47..b01fd6e 100644 --- a/scripts/toy/confession.groovy +++ b/scripts/toy/confession.groovy @@ -92,4 +92,5 @@ }; toy.addRequestable("confess", "Confess", { toy.confess() }); + return null; } diff --git a/scripts/toy/debug.groovy b/scripts/toy/debug.groovy index 560fe87..7f5f715 100644 --- a/scripts/toy/debug.groovy +++ b/scripts/toy/debug.groovy @@ -35,4 +35,5 @@ toy.addRequestable("status", "Status", { toy.setupShowState() }); toy.addRequestable("play", "Play", { toy.playEvent(true, false) }); toy.addRequestable("activitity", "Activity", { toy.playActivity() }); + return null; } diff --git a/scripts/toy/humiliation.groovy b/scripts/toy/humiliation.groovy index 06e422d..a039cdb 100644 --- a/scripts/toy/humiliation.groovy +++ b/scripts/toy/humiliation.groovy @@ -168,4 +168,5 @@ toy.addRequestable("clothes", "May I wear clothes", { toy.requestClothes() }, { toy.stateIs(toy.NAKED) }); + return null; } diff --git a/scripts/toy/imagery.groovy b/scripts/toy/imagery.groovy index b437fec..79b7abf 100644 --- a/scripts/toy/imagery.groovy +++ b/scripts/toy/imagery.groovy @@ -139,4 +139,5 @@ loadDomme(OWNER, outfit.set); return outfit.set; }; + return null; } diff --git a/scripts/toy/intro.groovy b/scripts/toy/intro.groovy index bf6be9e..61044df 100644 --- a/scripts/toy/intro.groovy +++ b/scripts/toy/intro.groovy @@ -49,4 +49,5 @@ save("toy.version", VERSION); }; toy.setupInitial(); + return null; } diff --git a/scripts/toy/misc.groovy b/scripts/toy/misc.groovy index bb88a7f..3e471a9 100644 --- a/scripts/toy/misc.groovy +++ b/scripts/toy/misc.groovy @@ -9,4 +9,5 @@ toy.addNamedEvent(toy.PERMIT, { name, arg, schedTime, rt -> toy.givePermission(arg) }); toy.addRequestable("faq", "FAQ (webpage)", { useUrl("http://toy.randomdan.homeip.net/"); }); toy.addActivity("playNothing", { toy.playNothing() }); + return null; } diff --git a/scripts/toy/orgasmControl.groovy b/scripts/toy/orgasmControl.groovy index 8568067..fa440c5 100644 --- a/scripts/toy/orgasmControl.groovy +++ b/scripts/toy/orgasmControl.groovy @@ -139,4 +139,5 @@ toy.addEventIfMissing(toy.CUM, toy.getTime() + (toy.DAY * 2) + toy.getRandom(toy.DAY * 2), toy.PERMIT, toy.CUM); }); + return null; } diff --git a/scripts/toy/pain.groovy b/scripts/toy/pain.groovy index 9e6b0c7..bc58ab5 100644 --- a/scripts/toy/pain.groovy +++ b/scripts/toy/pain.groovy @@ -133,4 +133,5 @@ toy.addActivity('playClamps', { toy.playClamps() }); toy.addActivity('intSqueeze', { toy.intSqueeze() }); toy.addActivity('intClamps', { toy.intClamps() }); + return null; } diff --git a/scripts/toy/play.groovy b/scripts/toy/play.groovy index 6889693..b892a04 100644 --- a/scripts/toy/play.groovy +++ b/scripts/toy/play.groovy @@ -320,4 +320,5 @@ { toy.stateIs(toyState) }) }; toy.playSchedule(); + return null; } diff --git a/scripts/toy/sleep.groovy b/scripts/toy/sleep.groovy index c49d511..3d9b531 100644 --- a/scripts/toy/sleep.groovy +++ b/scripts/toy/sleep.groovy @@ -65,4 +65,5 @@ toy.addNamedEvent(BEDTIME, { name, arg, schedTime, rt -> toy.bedtime(rt, schedTime) }); toy.addNamedEvent(BEDTIMECHECK, { name, arg, schedTime, rt -> toy.bedtimeCheck(rt) }); toy.sleepSchedule(); + return null; } diff --git a/scripts/toy/social.groovy b/scripts/toy/social.groovy index 028106f..9844940 100644 --- a/scripts/toy/social.groovy +++ b/scripts/toy/social.groovy @@ -85,4 +85,5 @@ toy.addNamedEvent(ENDPLAN, { name, arg, schedTime, rt -> toy.endPlan(rt) }); toy.addRequestable("calendar", "Calendar", { toy.showCalendar() }); toy.setupPlans(); + return null; } diff --git a/scripts/toy/tease.groovy b/scripts/toy/tease.groovy index eba22bd..5ace6e3 100644 --- a/scripts/toy/tease.groovy +++ b/scripts/toy/tease.groovy @@ -189,4 +189,5 @@ toy.addActivity("playStrokes", { toy.playStrokes() }); toy.addActivity("playEdges", { toy.playEdges() }); toy.addActivity("preEdge", { toy.preEdge() }); + return null; } -- cgit v1.2.3