summaryrefslogtreecommitdiff
path: root/scripts/toy.groovy
diff options
context:
space:
mode:
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 ]);
};