summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-07-13 14:12:46 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-07-13 14:12:46 +0100
commit2d59e8c3f208b40b3aca6b24015a9108b2125ab0 (patch)
treeaca7c89bf517152078546aa8b1c94e377108feb0
parentRemove gag before cuffs if playSuck called whilst toy is gagged (diff)
downloadtoy-2d59e8c3f208b40b3aca6b24015a9108b2125ab0.zip
Make closures final
-rw-r--r--scripts/toy.groovy22
-rw-r--r--scripts/toy/availability.groovy4
-rw-r--r--scripts/toy/humiliation.groovy6
-rw-r--r--scripts/toy/play.groovy4
4 files changed, 18 insertions, 18 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 286ffad..85988c7 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -46,7 +46,7 @@ return new Object() {
// Imagery
final DRESSED = "dressed", TITS = "tits", PUSSY = "pussy", LINGERIE = "lingerie", TEASE = "tease", SIT = "sit", BOOTS = "boots", KNEEL = "kneel", STOOD = "stood", MEAN = "mean", CROP = "crop", ASS = "ass", SQUAT = "squat", SSSH = "sssh";
final nDRESSED = "!$DRESSED", nTITS = "!$TITS", nTEASE = "!$TEASE", nKNEEL = "!$KNEEL", nSQUAT = "!$SQUAT";
- def loadDomme = { domme, set = null ->
+ final loadDomme = { domme, set = null ->
final readDomme = { path ->
if (!path) return [:];
final f = new File(path);
@@ -60,7 +60,7 @@ return new Object() {
.collect { readDomme(it) }
.sum()
};
- def loadModules = { toy ->
+ final loadModules = { toy ->
new File("$DATAFOLDER/scripts/toy")
.listFiles()
.collect { s ->
@@ -135,7 +135,7 @@ return new Object() {
void setAway(String a) { save("toy.owner.away", a) }
int randRange(int min, int max) { min + getRandom(1 + max - min) }
int randRange(double min, double max) { randRange((int)min, (int)max) }
- def setDefault = { prop, val ->
+ final setDefault = { prop, val ->
if (loadString(prop) == null) {
save(prop, val);
}
@@ -149,7 +149,7 @@ return new Object() {
int time;
String func;
Object arg;
- def map = {
+ final map = {
[
time: time,
func: func,
@@ -229,7 +229,7 @@ return new Object() {
def sessionAborted = null;
def sessionToys = [:];
- def gagText = { t, p ->
+ final gagText = { t, p ->
if (!stateIs(GAGGED)) return t.toString();
return t.split(/\s+/)
.collect {
@@ -240,16 +240,16 @@ return new Object() {
.join(" ")
.capitalize() + " ($p)";
};
- def showButtonG = { s, p, t = null ->
+ final showButtonG = { s, p, t = null ->
return t != null ? showButton(gagText(s, p), t) : showButton(gagText(s, p));
};
- def compose = { texts ->
+ final compose = { texts ->
if (!texts || texts.isEmpty()) return null;
return texts.collect {
t -> t[getRandom(t.size())]
}.join(" ").capitalize();
};
- def present = { imageSpec, texts ->
+ final present = { imageSpec, texts ->
if (texts) {
show(compose(texts));
}
@@ -258,7 +258,7 @@ return new Object() {
}
return null;
};
- def showButtonGT = { s, p, t, pc ->
+ final showButtonGT = { s, p, t, pc ->
def tt = showButton(gagText(s, p), t);
if (tt == t) {
present(null, [
@@ -292,7 +292,7 @@ return new Object() {
};
// Session
- def sessionSummon = { imageSpec ->
+ final sessionSummon = { imageSpec ->
final limit = 5;
final timeMax = 10;
executeTrigger("toySummoned");
@@ -328,7 +328,7 @@ return new Object() {
executeTrigger("toySummonFail");
return false;
};
- def setSessionAbort = { String r = null -> sessionAborted = r };
+ final setSessionAbort = { String r = null -> sessionAborted = r };
final activityList = [:];
final addActivity = { String name, func, images = [], tags = [] ->
diff --git a/scripts/toy/availability.groovy b/scripts/toy/availability.groovy
index 27b977a..f5d6ad8 100644
--- a/scripts/toy/availability.groovy
+++ b/scripts/toy/availability.groovy
@@ -1,6 +1,6 @@
{ toy ->
- def getAvail = { int dayNum -> toy.loadInteger("toy.availability.$dayNum") ?: 0 };
- def addAvail = { amount ->
+ final getAvail = { int dayNum -> toy.loadInteger("toy.availability.$dayNum") ?: 0 };
+ final addAvail = { amount ->
if (!amount) return;
def dayNum = toy.getDayNum();
toy.save("toy.availability.$dayNum", (int)(getAvail(dayNum) + amount));
diff --git a/scripts/toy/humiliation.groovy b/scripts/toy/humiliation.groovy
index f9df76e..25648d2 100644
--- a/scripts/toy/humiliation.groovy
+++ b/scripts/toy/humiliation.groovy
@@ -50,17 +50,17 @@
};
toy.metaClass.playSuck {
- def playWait = { file, time ->
+ final playWait = { file, time ->
playBackgroundSound(file);
pause(time);
playBackgroundSound(null);
};
- def suck = { file, n, delay ->
+ final suck = { file, n, delay ->
n.times {
playWait(file, delay);
};
};
- def suckBeat = { beat, n ->
+ final suckBeat = { beat, n ->
suck("toy/${beat}bpm.mp3", n, 2 * (60 / beat));
};
def completed = loadInteger("toy.deepthroat.completed") ?: 0;
diff --git a/scripts/toy/play.groovy b/scripts/toy/play.groovy
index f30f19c..c4e86a0 100644
--- a/scripts/toy/play.groovy
+++ b/scripts/toy/play.groovy
@@ -12,7 +12,7 @@
'punishMultiple': (float)1.0,
'prop': load('toy') ?: [:]
];
- def apply = { activitity, use = null ->
+ final apply = { activitity, use = null ->
if (!activitity) return;
def val = activitity.func();
playBackgroundSound(null);
@@ -20,7 +20,7 @@
use(val);
}
};
- def interval = { activities ->
+ final interval = { activities ->
if (activities) {
apply(activities[getRandom(activities.size())], null);
}