From 213b83871dd024b69626e7d28ed81c6b537bf36f Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Thu, 8 Sep 2011 18:31:08 -0400 Subject: [PATCH] chillmeter: make decay work properly with negative chill level --- modules/chillmeter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/chillmeter.py b/modules/chillmeter.py index b46e965..97657ab 100644 --- a/modules/chillmeter.py +++ b/modules/chillmeter.py @@ -67,8 +67,12 @@ def measure(phenny, input): now = time.time() if now - measure.last_tick > 60: measure.last_tick = now - chill -= chill_decay_rate - chill = max(0, chill) + if chill > 0: + chill -= chill_decay_rate + chill = max(0, chill) + elif chill < 0: + chill += chill_decay_rate + chill = min(0, chill) measure.channels[input.sender] = chill if ".chill" in input: