mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Merge pull request #9418 from mwerezak/port-gen
Fixes portable generators going above their temperature limit
This commit is contained in:
@@ -214,7 +214,11 @@
|
||||
else if (temperature > upper_limit)
|
||||
bias = max(round((temperature - average)/TEMPERATURE_DIVISOR, 1), -TEMPERATURE_CHANGE_MAX)
|
||||
|
||||
temperature += rand(-7 + bias, 7 + bias)
|
||||
//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)
|
||||
var/dec_limit = min(temperature - lower_limit, 0)
|
||||
temperature += between(dec_limit, rand(-7 + bias, 7 + bias), inc_limit)
|
||||
|
||||
if (temperature > max_temperature)
|
||||
overheat()
|
||||
|
||||
Reference in New Issue
Block a user