diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-01-03 01:37:07 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-01-03 01:37:11 +0000 |
commit | 7e0e0e3637ba65ab6e76f1e15dcf647d49bb1077 (patch) | |
tree | ba7cc60a3aee352e8ed2d11543c16f33cefae7c0 | |
parent | Align sizes/paths/styles to render correctly in cgit and native (diff) | |
download | toy-7e0e0e3637ba65ab6e76f1e15dcf647d49bb1077.zip |
Fix scheduling of play event
Is now always based on time of last play (written by sessionRelease) as
opposed to sometimes being based on current time even if the event was fired
in the background.
-rw-r--r-- | scripts/toy.groovy | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index c819901..7e529ae 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -1167,6 +1167,7 @@ def sessionRelease = { goodToy -> revokePermission(CUM); } wait(10); + save("toy.lastPlay", getTime()); showLounge(); sessionAborted = null; sessionToys = [:]; @@ -1187,8 +1188,9 @@ def playWait = { show(null); wait(20 + getRandom(20)); }; -def playSchedule = { lastPlay -> +def playSchedule = { if (getAway()) return; + final lastPlay = loadInteger("toy.lastPlay") ?: 0; if (lastPlay < getTime() - (4 * HOUR)) { addEventIfMissing(PLAY, getTime() + 120 + getRandom(480), PLAY, true); // 2-10mins } @@ -1205,12 +1207,11 @@ def playEvent = { rt = true, first = true -> } sessionPlay(); sessionRelease(sessionAborted == null); - save("toy.lastPlay", getTime()); } else { adjustPunish(25); } - playSchedule(getTime()); + playSchedule(); showLounge(); } def sleepSchedule = { @@ -1262,7 +1263,7 @@ def bedtimeCheck = { rt -> }; def wakeup = { rt -> setAway(null); - playSchedule(loadInteger("toy.lastPlay") ?: 0); + playSchedule(); sleepSchedule(); }; def redress = { rt -> @@ -1407,7 +1408,7 @@ def confess = { removeEvent(PLAY); sessionPlay(); sessionRelease(sessionAborted == null); - playSchedule(getTime()); + playSchedule(); } else { present([DRESSED, nTEASE], [ @@ -1433,7 +1434,7 @@ def setupPlans = { setupPlan(PARTY, 19, 20, 22.0, 25.0) }; def setupEvents = { - playSchedule(loadInteger("toy.lastPlay") ?: 0); + playSchedule(); sleepSchedule(); setupPlans(); }; @@ -1484,7 +1485,7 @@ def endPlan = { rt, plan -> showLounge(); } readNote(); - playSchedule(getTime()); + playSchedule(); setupPlans(); }; // Initial - basic checks and defaults |