summaryrefslogtreecommitdiff
path: root/scripts/toy.groovy
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-06-19 21:04:34 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-06-19 21:04:34 +0100
commit4902903b3a23179533e90a26c06e2daa61e66803 (patch)
treeafc6c472938f6b5ea6c4b2a07bd4cc0a2a5830d9 /scripts/toy.groovy
parentLoad modules from the scripts/toy folder (diff)
downloadtoy-4902903b3a23179533e90a26c06e2daa61e66803.zip
Extract social into a module
Diffstat (limited to 'scripts/toy.groovy')
-rw-r--r--scripts/toy.groovy100
1 files changed, 15 insertions, 85 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 1dfadca..d7747a7 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -34,8 +34,6 @@ return new Object() {
final RELEASEFROM = "releaseFrom";
final LUNCH = "lunch", SHOPPING = "shopping", PARTY = "party", SLEEPING = "sleeping";
final BEDTIME = "bedtime", WAKEUP = "wakeup", BEDTIMECHECK = "bedtimeCheck";
- final BEGINPLAN = "beginPlan", ENDPLAN = "endPlan";
- final FRIENDS = [ "Tori", "Sophie", "Krystal" ];
// toy.position
final KNEELING = "kneeling", ALLFOURS = "allfours", STANDING = "standing";
def OWNER = null;
@@ -1792,85 +1790,19 @@ return new Object() {
};
// Setup
- // Plans - cannot overlap
- def setupPlan = { plan, float startmin, float startmax, float endmin, float endmax ->
- def timeWindow = { float min, float max -> (int)((min * HOUR) - localTimeOffset() + getRandom((int)((max - min) * HOUR))) };
- final friendName = FRIENDS[getRandom(FRIENDS.size())];
- def day = getDay() + ((getRandom(3) + 1) * DAY);
- addEventIfMissing(plan, day + timeWindow(startmin, startmax), BEGINPLAN,
- [friendName: friendName, returnTime: day + timeWindow(endmin, endmax)]);
- }
- def setupPlans = {
- save("toy.plan", null);
- setupPlan(LUNCH, 11.5, 12.5, 13.0, 14.0)
- setupPlan(SHOPPING, 14.5, 15.5, 16.0, 18.0)
- setupPlan(PARTY, 19, 20, 22.0, 25.0)
- };
def setupEvents = {
playSchedule();
sleepSchedule();
- setupPlans();
};
def setDefault = { prop, val ->
if (loadString(prop) == null) {
save(prop, val);
}
};
- def leaveNote = { msg, instr ->
- save("toy.note", msg);
- save("toy.noteInstr", instr);
- };
- def readNote = {
- leaveNote(null, null);
- };
- def plannedCheck = { plan ->
- return (getTime() > loadInteger("toy.plan.${plan}.${START}") && getTime() < loadInteger("toy.plan.${plan}.${END}"));
- }
- def beginPlan = { rt, plan, args ->
- addEvent(plan, args.returnTime, ENDPLAN, args.friendName);
- dress([[DRESSED,nTEASE], [DRESSED,TEASE]]);
- if (rt && sessionSummon([DRESSED,nTEASE])) {
- present([DRESSED,nTEASE], [
- [ "I'm going out now, toy.", "$plan time!" ],
- [ "Will you be good while I'm gone?", "You will behave as I expect?" ]]);
- wait(10);
- postChastity();
- def toys = TOYTOYS.findAll { t -> stateIs(t) };
- Collections.shuffle(toys);
- toys.each { removeToy(it, [DRESSED,nTEASE]) };
- removeEvent(REDRESS);
- set(NAKED, false);
- present([DRESSED,TEASE], [
- [ "Back later!", "See you soon, toy" ]]);
- wait(5);
- }
- else if (has(CHASTITY) && !stateIs(CHASTE)) {
- leaveNote("I want you in chastity until I return!", CHASTE);
- }
- DOMME = loadDomme(OWNER);
- setAway(plan);
- removeEvent(PLAY);
- showLounge();
- };
- def endPlan = { rt, plan ->
- save("toy.owner.outfitTime", getTime());
- setAway(null);
- if (rt && sessionSummon([DRESSED])) {
- present([DRESSED], [["Hello, toy!"], ["I'm back home now."]]);
- wait(10);
- showLounge();
- }
- readNote();
- playSchedule();
- setupPlans();
- };
- // Initial - basic checks and defaults
def namedEvents = [
bedtime: { name, arg, schedTime, rt -> bedtime(rt, schedTime) },
bedtimeCheck: { name, arg, schedTime, rt -> bedtimeCheck(rt) },
wakeup: { name, arg, schedTime, rt -> wakeup(rt) },
- beginPlan: { name, arg, schedTime, rt -> beginPlan(rt, name, arg) },
- endPlan: { name, arg, schedTime, rt -> endPlan(rt, name) },
play: { name, arg, schedTime, rt -> playEvent(rt, arg) },
releaseFrom: { name, arg, schedTime, rt -> releaseFrom(rt, arg, name) },
redress: { name, arg, schedTime, rt -> redress(rt) },
@@ -1952,18 +1884,19 @@ return new Object() {
def showFaq = {
useUrl("http://toy.randomdan.homeip.net/");
};
- def setupShowCalendar = {
- final events = loadEvents();
- show(
- [LUNCH, SHOPPING, PARTY].collect {
- final event = events[it];
- if (!event) return "";
- def s = event.time;
- def f = event.arg.friendName;
- def timeStr = localTimeOf(s).format(soonFormatter);
- return "$it with $f on $timeStr.\n".capitalize();
- }.join());
- showButton("OK");
+
+ final addNamedEvent = { String name, func ->
+ namedEvents[name] = func;
+ }
+ def requestables = [
+ faq: [ lbl: "FAQ (webpage)", act: showFaq ],
+ confess: [ lbl: "Confess", act: confess ],
+ ];
+ final addRequestable = { String name, String label, func ->
+ requestables[name] = [lbl: label, act: func];
+ };
+ final removeRequestable = { String name ->
+ requestables.remove(name);
};
String main()
@@ -2030,11 +1963,7 @@ return new Object() {
final waitTime = Math.min(cycleTime, e.event.time - getTime());
final clickTime = showButton("Please, ${dommeTitle()}?", waitTime);
if (clickTime < waitTime) {
- def opts = [
- [ lbl: "FAQ (webpage)", act: showFaq ],
- [ lbl: "Calendar", act: setupShowCalendar ],
- [ lbl: "Confess", act: confess ],
- ];
+ def opts = requestables.values().toList();
if (stateIs("DEBUG")) {
opts.push([ lbl: "Status", act: setupShowState ]);
opts.push([ lbl: "Play", act: playEvent, arg: true ]);
@@ -2067,6 +1996,7 @@ return new Object() {
/*
* Resources
* scripts/toy.groovy
+ * scripts/toy/social.groovy
* images/toy/ancilla/corset/1.jpg
* images/toy/ancilla/corset/10.jpg
* images/toy/ancilla/corset/11.jpg