From cf591c290b2f967378a0e447a6f49fe0b43eee16 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Fri, 22 May 2015 02:21:12 -0400 Subject: [PATCH] Adds limit to prevent random walking below the lower limit temperature, too. --- code/modules/power/port_gen.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 88cc4b5707..61cf05477a 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -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()