summaryrefslogtreecommitdiff
path: root/scripts/toy.groovy
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-06-23 20:52:20 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-06-23 21:18:22 +0100
commit487813b6de6d17649cce562d6a0b007afdc07427 (patch)
tree4ec28c71ff8577c496ae820d83723b940c8f841b /scripts/toy.groovy
parentExtract play into a module (diff)
downloadtoy-487813b6de6d17649cce562d6a0b007afdc07427.zip
Conditional requestables and move clothing request
Diffstat (limited to 'scripts/toy.groovy')
-rw-r--r--scripts/toy.groovy11
1 files changed, 5 insertions, 6 deletions
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 ]);
};