From 7e0e0e3637ba65ab6e76f1e15dcf647d49bb1077 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 3 Jan 2019 01:37:07 +0000 Subject: 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. --- scripts/toy.groovy | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'scripts') 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 -- cgit v1.2.3