From 1b8abeee190eaa2674d82c5137eae6bc6224acf0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 8 Jul 2019 21:50:10 +0100 Subject: Dynamic build sessions from activity tags --- scripts/toy.groovy | 1 + scripts/toy/bondage.groovy | 4 ++-- scripts/toy/chastity.groovy | 4 ++-- scripts/toy/play.groovy | 10 ++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 6f87485..3d32f62 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -313,6 +313,7 @@ return new Object() { final activityList = [:]; final addActivity = { String name, func, images = [], tags = [] -> activityList[name] = [ + name: name, func: func, tags: tags ?: [], images: images ?: [] diff --git a/scripts/toy/bondage.groovy b/scripts/toy/bondage.groovy index ce17774..d0cf42b 100644 --- a/scripts/toy/bondage.groovy +++ b/scripts/toy/bondage.groovy @@ -92,8 +92,8 @@ return waitTime; }; - toy.addActivity("preGag", { toy.preGag() }, [[toy.DRESSED]], [toy.PRE, toy.HUMILIATION, toy.BONDAGE]); - toy.addActivity("preCollar", { toy.preCollar() }, [[toy.DRESSED]], [toy.PRE, toy.HUMILIATION, toy.BONDAGE]); + toy.addActivity("preGag", { toy.preGag() }, [[toy.DRESSED]], [toy.PRE, toy.HUMILIATION, toy.BONDAGE, toy.BALLGAG]); + toy.addActivity("preCollar", { toy.preCollar() }, [[toy.DRESSED]], [toy.PRE, toy.HUMILIATION, toy.BONDAGE, toy.COLLAR]); toy.addActivity("playBondage", { toy.playBondage() }, [ [toy.DRESSED, toy.nTEASE], [toy.DRESSED, toy.TEASE], [toy.STOOD] ], [toy.PLAY, toy.PUNISH, toy.BONDAGE]); return { diff --git a/scripts/toy/chastity.groovy b/scripts/toy/chastity.groovy index 7fd5830..403b678 100644 --- a/scripts/toy/chastity.groovy +++ b/scripts/toy/chastity.groovy @@ -106,8 +106,8 @@ } }; - toy.addActivity('preRelease', { toy.preRelease() }, [[toy.DRESSED, toy.TEASE]], [toy.PRE, toy.REWARD]); - toy.addActivity('preChastity', { toy.preChastity() }, [[toy.DRESSED, toy.TEASE]], [toy.PRE, toy.PUNISH]); + toy.addActivity('preRelease', { toy.preRelease() }, [[toy.DRESSED, toy.TEASE]], [toy.PRE, toy.REWARD, toy.CHASTE]); + toy.addActivity('preChastity', { toy.preChastity() }, [[toy.DRESSED, toy.TEASE]], [toy.PRE, toy.PUNISH, toy.CHASTE]); toy.addActivity('postChastity', { toy.postChastity() }, [ [toy.DRESSED, toy.TEASE], [toy.DRESSED, toy.nTEASE]]); return null; diff --git a/scripts/toy/play.groovy b/scripts/toy/play.groovy index 03f6c80..2078d0b 100644 --- a/scripts/toy/play.groovy +++ b/scripts/toy/play.groovy @@ -59,6 +59,16 @@ ], 'activities': activityList ]; + // Expand wildcards + final expandWildcards = { list -> + list + .findAll { a -> a && a.startsWith("*") } + .collect { a -> list.remove(a); return a.substring(1).split(",") } + .collectMany { tags -> activityList.values().findAll(matchTags(tags))*.name } + .forEach { a -> list.add(a) }; + } + DOMME.sessions*.phases*.activities*.forEach { expandWildcards(it); } + DOMME.sessions*.phases*.intervals*.forEach { expandWildcards(it); } final eval = { expr -> Eval.me('toy', playScope, expr.toString()) }; if (stateIs("DEBUG")) { // Check everything in DOMME evaluates and resolves -- cgit v1.2.3