chillmeter: make decay work properly with negative chill level

master
mutantmonkey 2011-09-08 18:31:08 -04:00
parent dd0ade6136
commit 213b83871d
1 changed files with 6 additions and 2 deletions

View File

@ -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: