From 487813b6de6d17649cce562d6a0b007afdc07427 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 23 Jun 2019 20:52:20 +0100 Subject: Conditional requestables and move clothing request --- scripts/toy.groovy | 11 +++++------ scripts/toy/humiliation.groovy | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 5c3ab02..16df507 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -341,8 +341,8 @@ return new Object() { def requestables = [ faq: [ lbl: "FAQ (webpage)", act: showFaq ], ]; - final addRequestable = { String name, String label, func -> - requestables[name] = [lbl: label, act: func]; + final addRequestable = { String name, String label, func, cond = null -> + requestables[name] = [lbl: label, act: func, cond: cond]; }; final removeRequestable = { String name -> requestables.remove(name); @@ -417,15 +417,14 @@ return new Object() { final waitTime = Math.min(cycleTime, e.event.time - getTime()); final clickTime = showButton("Please, ${dommeTitle()}?", waitTime); if (clickTime < waitTime) { - def opts = requestables.values().toList(); + 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 ]); } - if (stateIs(NAKED)) { - opts.push([ lbl: "May I wear clothes", act: { requestClothes() } ]); - } TOYTOYS.findAll { stateIs(it) }.each { opts.push([ lbl: "May I be un-$it".toString(), act: { requestRelease() }, arg: it ]); }; diff --git a/scripts/toy/humiliation.groovy b/scripts/toy/humiliation.groovy index 8050145..06e422d 100644 --- a/scripts/toy/humiliation.groovy +++ b/scripts/toy/humiliation.groovy @@ -165,4 +165,7 @@ toy.addActivity("preStrip", { toy.preStrip() }); toy.addActivity("playKneel", { toy.playKneel() }); toy.addActivity("playSuck", { toy.playSuck() }); + toy.addRequestable("clothes", "May I wear clothes", + { toy.requestClothes() }, + { toy.stateIs(toy.NAKED) }); } -- cgit v1.2.3