From 2d59e8c3f208b40b3aca6b24015a9108b2125ab0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 13 Jul 2019 14:12:46 +0100 Subject: Make closures final --- scripts/toy.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts/toy.groovy') 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 = [] -> -- cgit v1.2.3