diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-06-20 19:24:42 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-06-20 19:24:42 +0100 |
commit | 51a981885d2dac9b86b31a4bb6367de99b355a3f (patch) | |
tree | a28363b8baafdf3edeb25d617c9ccdb0ae7a9767 /scripts | |
parent | Extract intro into a module (diff) | |
download | toy-51a981885d2dac9b86b31a4bb6367de99b355a3f.zip |
Extract sleeping into a module
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/toy.groovy | 62 | ||||
-rw-r--r-- | scripts/toy/sleep.groovy | 68 |
2 files changed, 69 insertions, 61 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 77c499c..e037277 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -32,8 +32,6 @@ return new Object() { final REDRESS = "redress"; final TOYTOYS = [CUFFED, COLLARED, CLAMPED, GAGGED]; final RELEASEFROM = "releaseFrom"; - final LUNCH = "lunch", SHOPPING = "shopping", PARTY = "party", SLEEPING = "sleeping"; - final BEDTIME = "bedtime", WAKEUP = "wakeup", BEDTIMECHECK = "bedtimeCheck"; // toy.position final KNEELING = "kneeling", ALLFOURS = "allfours", STANDING = "standing"; def OWNER = null; @@ -1582,61 +1580,6 @@ return new Object() { playSchedule(); showLounge(); } - def sleepSchedule = { - def t = (int)(getDay() - localTimeOffset() + (25.1 * HOUR) + getRandom((int)HOUR)); - addEventIfMissing(SLEEPING, t, BEDTIME); - }; - def bedtime = { rt, schedTime -> - dress([[LINGERIE,nTITS]]); - if (rt && sessionSummon([LINGERIE,nTITS])) { - preStrip([LINGERIE,nTITS]); - def toys = TOYTOYS.findAll { t -> stateIs(t) }; - Collections.shuffle(toys); - toys.each { removeToy(it, [LINGERIE,nTITS]) }; - present([LINGERIE,nTITS], [ - ["Very good, toy.", "OK."], - ["Bedtime for you!", "Off to bed with you!", "Bed! Now!"]]); - showButtonG("Good night, ${dommeTitle()}", "night"); - addEvent(BEDTIMECHECK, getTime() + 300 + getRandom(600), BEDTIMECHECK); - showLounge(); - } - // Assume toy will return dressed tomorrow - removeEvent(REDRESS); - set(NAKED, false); - // Assume toy will release himself - TOYTOYS.findAll { t -> stateIs(t) }.each { - removeEvent("$RELEASEFROM-$it"); - set(it, false); - }; - setAway(SLEEPING); - def t = schedTime + (6 * (int)HOUR) + getRandom(2 * (int)HOUR); - addEvent(SLEEPING, t, WAKEUP); - removeEvent(PLAY); - }; - def bedtimeCheck = { rt -> - dress([[LINGERIE,nTITS]]); - if (rt && sessionSummon([LINGERIE,nTITS])) { - present([LINGERIE,nTITS], [ - ["Hey!", "Ah ha!"], - ["What are you doing still up?", "Didn't I send you to bed?"]]); - showButtonG("Sorry, ${dommeTitle()}", "sorry"); - present([LINGERIE,nTITS], [ - ["Get yourself to bed", "In bed"], - ["right now!", "this instant!"], - ["I'll deal with you later."]]); - showButtonG("Yes, ${dommeTitle()}", "ok"); - adjustPunish(75); - showLounge(); - } - }; - def wakeup = { rt -> - // Unset outfit, stops bedtime wear always being selected first - save("toy.owner.outfit", null); - dress([]); - setAway(null); - playSchedule(); - sleepSchedule(); - }; def redress = { rt -> if (!rt || !sessionSummon([DRESSED])) { addEvent(REDRESS, getTime() + 300, "redress"); @@ -1792,7 +1735,6 @@ return new Object() { // Setup def setupEvents = { playSchedule(); - sleepSchedule(); }; def setDefault = { prop, val -> if (loadString(prop) == null) { @@ -1800,9 +1742,6 @@ return new Object() { } }; def namedEvents = [ - bedtime: { name, arg, schedTime, rt -> bedtime(rt, schedTime) }, - bedtimeCheck: { name, arg, schedTime, rt -> bedtimeCheck(rt) }, - wakeup: { name, arg, schedTime, rt -> wakeup(rt) }, play: { name, arg, schedTime, rt -> playEvent(rt, arg) }, releaseFrom: { name, arg, schedTime, rt -> releaseFrom(rt, arg, name) }, redress: { name, arg, schedTime, rt -> redress(rt) }, @@ -1947,6 +1886,7 @@ return new Object() { * Resources * scripts/toy.groovy * scripts/toy/intro.groovy + * scripts/toy/sleep.groovy * scripts/toy/social.groovy * images/toy/ancilla/corset/1.jpg * images/toy/ancilla/corset/10.jpg diff --git a/scripts/toy/sleep.groovy b/scripts/toy/sleep.groovy new file mode 100644 index 0000000..c49d511 --- /dev/null +++ b/scripts/toy/sleep.groovy @@ -0,0 +1,68 @@ +{ toy -> + final SLEEPING = "sleeping"; + final BEDTIME = "bedtime", WAKEUP = "wakeup", BEDTIMECHECK = "bedtimeCheck"; + + toy.metaClass.sleepSchedule { + def t = (int)(getDay() - localTimeOffset() + (25.1 * HOUR) + getRandom((int)HOUR)); + addEventIfMissing(SLEEPING, t, BEDTIME); + }; + + toy.metaClass.bedtime { rt, schedTime -> + dress([[LINGERIE,nTITS]]); + if (rt && sessionSummon([LINGERIE,nTITS])) { + preStrip([LINGERIE,nTITS]); + def toys = TOYTOYS.findAll { t -> stateIs(t) }; + Collections.shuffle(toys); + toys.each { removeToy(it, [LINGERIE,nTITS]) }; + present([LINGERIE,nTITS], [ + ["Very good, toy.", "OK."], + ["Bedtime for you!", "Off to bed with you!", "Bed! Now!"]]); + showButtonG("Good night, ${dommeTitle()}", "night"); + addEvent(BEDTIMECHECK, getTime() + 300 + getRandom(600), BEDTIMECHECK); + showLounge(); + } + // Assume toy will return dressed tomorrow + removeEvent(REDRESS); + set(NAKED, false); + // Assume toy will release himself + TOYTOYS.findAll { t -> stateIs(t) }.each { + removeEvent("$RELEASEFROM-$it"); + set(it, false); + }; + setAway(SLEEPING); + def t = schedTime + (6 * (int)HOUR) + getRandom(2 * (int)HOUR); + addEvent(SLEEPING, t, WAKEUP); + removeEvent(PLAY); + }; + + toy.metaClass.bedtimeCheck { rt -> + dress([[LINGERIE,nTITS]]); + if (rt && sessionSummon([LINGERIE,nTITS])) { + present([LINGERIE,nTITS], [ + ["Hey!", "Ah ha!"], + ["What are you doing still up?", "Didn't I send you to bed?"]]); + showButtonG("Sorry, ${dommeTitle()}", "sorry"); + present([LINGERIE,nTITS], [ + ["Get yourself to bed", "In bed"], + ["right now!", "this instant!"], + ["I'll deal with you later."]]); + showButtonG("Yes, ${dommeTitle()}", "ok"); + adjustPunish(75); + showLounge(); + } + }; + + toy.metaClass.wakeup { rt -> + // Unset outfit, stops bedtime wear always being selected first + save("toy.owner.outfit", null); + dress([]); + setAway(null); + playSchedule(); + sleepSchedule(); + }; + + toy.addNamedEvent(WAKEUP, { name, arg, schedTime, rt -> toy.wakeup(rt) }); + toy.addNamedEvent(BEDTIME, { name, arg, schedTime, rt -> toy.bedtime(rt, schedTime) }); + toy.addNamedEvent(BEDTIMECHECK, { name, arg, schedTime, rt -> toy.bedtimeCheck(rt) }); + toy.sleepSchedule(); +} |