summaryrefslogtreecommitdiff
path: root/scripts/toy.groovy
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-03-24 19:54:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-03-24 19:54:26 +0000
commit9f62cfcd5fd2486330d8fa4212c8ded4b24c3f66 (patch)
tree3fe8e0f86e5c7d50c19f78e6538d20b38e2d564b /scripts/toy.groovy
parentGet [mistress'] title from domme object (diff)
downloadtoy-9f62cfcd5fd2486330d8fa4212c8ded4b24c3f66.zip
Split domme config into default, person and set files
Diffstat (limited to 'scripts/toy.groovy')
-rw-r--r--scripts/toy.groovy30
1 files changed, 25 insertions, 5 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 0464e23..994af35 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -75,6 +75,20 @@ final IMAGEDATA = {
]
};
}();
+def loadDomme = { domme, set = null ->
+ final readDomme = { path ->
+ if (!path) return [:];
+ final f = new File(path);
+ if (!f.exists()) return [:];
+ return Eval.me(f.text);
+ };
+ return [
+ "$DATAFOLDER/images/toy/domme.groovy",
+ "$DATAFOLDER/images/toy/$domme/person.groovy",
+ "$DATAFOLDER/images/toy/$domme/$set/set.groovy" ]
+ .collect { readDomme(it) }
+ .sum()
+};
def selectImage = { domme, set, spec ->
def meets = { i ->
return spec.every({ s ->
@@ -119,6 +133,7 @@ def dress = { specs ->
if (prev) {
prev = prev.sets[outfit];
if (prev && specs.every({ spec -> selectImage(OWNER, prev.set, spec)})) {
+ DOMME = loadDomme(OWNER, outfit);
return outfit;
}
}
@@ -128,6 +143,7 @@ def dress = { specs ->
showPopup("No outfit for $OWNER : $specs");
save("toy.owner.outfit", null);
save("toy.owner.outfitTime", null);
+ DOMME = loadDomme(OWNER, outfit);
return;
}
save("toy.owner.outfit", outfit.set);
@@ -159,11 +175,13 @@ def getProp = {i, f, d = null ->
return v;
};
def getDommeProp = { i, d = null ->
+ if (DOMME == null) return d;
final v = DOMME[i];
if (v == null) return d;
return v;
};
def dommeTitle = { getDommeProp("title", "Mistress") };
+def dommeName = { getDommeProp("name", "") };
def loadB = { p -> loadBoolean(p)};
def loadI = { p -> loadInteger(p)};
def loadS = { p -> loadString(p)};
@@ -1729,6 +1747,7 @@ def beginPlan = { rt, plan, args ->
else if (has(CHASTITY) && !is(CHASTE)) {
leaveNote("I want you in chastity until I return!", CHASTE);
}
+ DOMME = loadDomme(OWNER);
setAway(plan);
removeEvent(PLAY);
showLounge();
@@ -1850,7 +1869,7 @@ def setupShowCalendar = {
// GO!
setDefault("toy.owner", "ancilla");
OWNER = loadString("toy.owner");
-DOMME = Eval.me(new File("$DATAFOLDER/images/toy/$OWNER/domme.groovy").text);
+DOMME = loadDomme(OWNER);
def getDayNum = { Math.floorDiv(getTime() + localTimeOffset() - 14400, 86400) };
def getAvail = { dayNum -> loadInteger("toy.availability.$dayNum") ?: 0 };
def addAvail = { amount ->
@@ -1883,7 +1902,7 @@ while (true) {
def note = loadString("toy.note");
def noteInstr = loadString("toy.noteInstr");
if (note) {
- show("${dommeTitle()} is away ($away)... but you find a note:\n$note");
+ show("${dommeTitle()} ${dommeName()} is away ($away)... but you find a note:\n$note");
showButton("OK");
if (noteInstr) {
set(noteInstr, true);
@@ -1891,7 +1910,7 @@ while (true) {
readNote();
}
else {
- show("${dommeTitle()} is away ($away)...");
+ show("${dommeTitle()} ${dommeName()} is away ($away)...");
}
if (e && e.event && e.event.time > getTime()) {
wait(e.event.time - getTime());
@@ -1903,7 +1922,7 @@ while (true) {
show("$e.name: $timeStr -> ${e.event.func}(${e.event.arg})");
}
else {
- show("${dommeTitle()} will summon you when required.");
+ show("${dommeTitle()} ${dommeName()} will summon you when required.");
}
final waitTime = Math.min(cycleTime, e.event.time - getTime());
final clickTime = showButton("Please, ${dommeTitle()}?", waitTime);
@@ -2010,7 +2029,8 @@ while (true) {
* images/toy/ancilla/pink/9.jpg
* images/toy/ancilla/pink/tags
* images/toy/ancilla/lounge.jpg
- * images/toy/ancilla/domme.groovy
+ * images/toy/ancilla/person.groovy
+ * images/toy/domme.groovy
* sounds/toy/165bpm.mp3
* sounds/toy/180bpm.mp3
* sounds/toy/240bpm.mp3