diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-06-23 21:03:06 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-06-23 21:18:22 +0100 |
commit | cbd6292b0a0c28f2ec3be418b5df346a3c00dca5 (patch) | |
tree | e347bba91e97c82e8ece1df04ce3667ca8298cc9 /scripts | |
parent | Conditional requestables and move clothing request (diff) | |
download | toy-cbd6292b0a0c28f2ec3be418b5df346a3c00dca5.zip |
Extract debug functions into a module
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/toy.groovy | 33 | ||||
-rw-r--r-- | scripts/toy/debug.groovy | 38 |
2 files changed, 38 insertions, 33 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 16df507..8ad391b 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -294,11 +294,6 @@ return new Object() { final addActivity = { String name, func -> activityList[name] = func; } - def playActivity = { - final keys = new ArrayList<?>(activityList.keySet()); - final act = getSelectedValue("Choose activity", keys); - activityList[keys[act]](); - }; // Setup def setDefault = { prop, val -> if (loadString(prop) == null) { @@ -308,29 +303,6 @@ return new Object() { def namedEvents = [ permit: { name, arg, schedTime, rt -> givePermission(arg) } ]; - def setupShowState = { - def localTimeStr = localTimeOf(getTime()).format(soonFormatter); - show("localTime: $localTimeStr\noffsetSet: ${localTimeOffset()}\ntime_t: ${getTime()}"); - showButton("OK"); - show( - [CHASTE, COLLARED, CUFFED, CLAMPED, GAGGED, NAKED].collect { - def v = stateIs(it); - return "$it: $v\n".capitalize() - }.join()); - showButton("OK"); - show( - [BALLGAG, COLLAR, CLAMPS, CHASTITY, HANDCUFFS, DILDO].collect { - def v = has(it); - return "$it: $v\n".capitalize() - }.join()); - showButton("OK"); - show( - [BONDAGE, CBT, CHORES, PAIN].collect { - def v = likes(it); - return "$it: $v\n".capitalize() - }.join()); - showButton("OK"); - }; def showFaq = { useUrl("http://toy.randomdan.homeip.net/"); }; @@ -420,11 +392,6 @@ return new Object() { def opts = requestables.values().toList().findAll { it -> !it.cond || it.cond() }; - if (stateIs("DEBUG")) { - opts.push([ lbl: "Status", act: setupShowState ]); - opts.push([ lbl: "Play", act: { playEvent() }, arg: true ]); - opts.push([ lbl: "Activity", act: playActivity ]); - } TOYTOYS.findAll { stateIs(it) }.each { opts.push([ lbl: "May I be un-$it".toString(), act: { requestRelease() }, arg: it ]); }; diff --git a/scripts/toy/debug.groovy b/scripts/toy/debug.groovy new file mode 100644 index 0000000..560fe87 --- /dev/null +++ b/scripts/toy/debug.groovy @@ -0,0 +1,38 @@ +{ toy -> + if (!toy.stateIs("DEBUG")) { + return; + } + toy.metaClass.setupShowState { + def localTimeStr = localTimeOf(getTime()).format(soonFormatter); + show("localTime: $localTimeStr\noffsetSet: ${localTimeOffset()}\ntime_t: ${getTime()}"); + showButton("OK"); + show( + [CHASTE, COLLARED, CUFFED, CLAMPED, GAGGED, NAKED].collect { + def v = stateIs(it); + return "$it: $v\n".capitalize() + }.join()); + showButton("OK"); + show( + [BALLGAG, COLLAR, CLAMPS, CHASTITY, HANDCUFFS, DILDO].collect { + def v = has(it); + return "$it: $v\n".capitalize() + }.join()); + showButton("OK"); + show( + [BONDAGE, CBT, CHORES, PAIN].collect { + def v = likes(it); + return "$it: $v\n".capitalize() + }.join()); + showButton("OK"); + }; + + toy.metaClass.playActivity { + final keys = new ArrayList<?>(activityList.keySet()); + final act = getSelectedValue("Choose activity", keys); + activityList[keys[act]](); + }; + + toy.addRequestable("status", "Status", { toy.setupShowState() }); + toy.addRequestable("play", "Play", { toy.playEvent(true, false) }); + toy.addRequestable("activitity", "Activity", { toy.playActivity() }); +} |