diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-18 19:49:41 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-18 19:49:41 +0000 |
commit | ae2c20f8e8ea87ef45ed5dd2dfff53be248a4032 (patch) | |
tree | 447b2b84b87284d023a10c697807d389fc7971d7 /scripts | |
parent | Unset outfit properties when dress() fails (diff) | |
download | toy-ae2c20f8e8ea87ef45ed5dd2dfff53be248a4032.zip |
Adjust flow to improve test run-ability (again)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/toy.groovy | 15 |
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); |