Adds limit to prevent random walking below the lower limit temperature, too.

This commit is contained in:
mwerezak
2015-05-22 02:21:12 -04:00
parent 4d54742079
commit cf591c290b
+2 -1
View File
@@ -217,7 +217,8 @@
//limit temperature increase so that it cannot raise temperature above upper_limit,
//or if it is already above upper_limit, limit the increase to 0.
var/inc_limit = max(upper_limit - temperature, 0)
temperature += min(rand(-7 + bias, 7 + bias), inc_limit)
var/dec_limit = min(temperature - lower_limit, 0)
temperature += between(dec_limit, rand(-7 + bias, 7 + bias), inc_limit)
if (temperature > max_temperature)
overheat()