summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-12-03 11:21:24 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2018-12-03 11:21:24 +0000
commitffb8fcf60a3c01d13b25b0af3146a627accd3c67 (patch)
tree33b2a410ef8521672046ad9f3614dbd48c2b98ce
parentAdd plain text hint to gagged text buttons. (diff)
downloadtoy-ffb8fcf60a3c01d13b25b0af3146a627accd3c67.zip
Fix adjustPunish
-rw-r--r--scripts/toy.groovy2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 7ba695f..3807e97 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -169,8 +169,8 @@ def can = {i -> loadBoolean("toy.permission.$i") == true};
def is = {i -> loadBoolean("toy.state.$i") == true};
def set = {i, s -> save("toy.state.$i", s)};
def positioned = { i -> loadString("toy.position") == i };
-def adjustPunish = { p -> save("toy.punishment", getPunish() + p); };
def getPunish = { loadInteger("toy.punishment"); };
+def adjustPunish = { p -> save("toy.punishment", Math.max(getPunish() + (int)p, 0)); };
def sessionAborted = null;
def gagText = { t, p ->
if (!is(GAGGED)) return t;