summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/toy.groovy15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index a33959c..7b13571 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -100,8 +100,9 @@ def showLounge = {
};
def selectImageSet = { domme, specs ->
def matches = IMAGEDATA
- .find({ d -> d.domme == domme })
- .sets.findAll({ s -> specs.every({ spec -> selectImage(domme, s.set, spec)})});
+ .find({ d -> d.domme == domme });
+ if (!matches) return null;
+ matches = matches.sets.findAll({ s -> specs.every({ spec -> selectImage(domme, s.set, spec)})});
return matches[getRandom(matches.size())];
};
def dress = { specs ->
@@ -109,10 +110,12 @@ def dress = { specs ->
def outfitTime = loadInteger("toy.owner.outfitTime");
if (outfitTime > getTime() - 7200) { // Recent, check
def prev = IMAGEDATA
- .find({ d -> d.domme == OWNER })
- .sets.find({ s -> s.set == outfit });
- if (prev && specs.every({ spec -> selectImage(OWNER, prev.set, spec)})) {
- return outfit;
+ .find({ d -> d.domme == OWNER });
+ if (prev) {
+ prev = prev.sets.find({ s -> s.set == outfit });
+ if (prev && specs.every({ spec -> selectImage(OWNER, prev.set, spec)})) {
+ return outfit;
+ }
}
}
outfit = selectImageSet(OWNER, specs);