mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-21 03:56:47 +01:00
Fixes temperature HUD being incorrect for species with null body_temperature.
This commit is contained in:
@@ -1322,31 +1322,36 @@
|
||||
if(260 to 280) bodytemp.icon_state = "temp-3"
|
||||
else bodytemp.icon_state = "temp-4"
|
||||
else
|
||||
//TODO: precalculate all of this stuff when the species datum is created
|
||||
var/base_temperature = species.body_temperature
|
||||
if(base_temperature == null) //some species don't have a set metabolic temperature
|
||||
base_temperature = (species.heat_level_1 + species.cold_level_1)/2
|
||||
|
||||
var/temp_step
|
||||
if (bodytemperature >= species.body_temperature)
|
||||
temp_step = (species.heat_level_1 - species.body_temperature)/4
|
||||
if (bodytemperature >= base_temperature)
|
||||
temp_step = (species.heat_level_1 - base_temperature)/4
|
||||
|
||||
if (bodytemperature >= species.heat_level_1)
|
||||
bodytemp.icon_state = "temp4"
|
||||
else if (bodytemperature >= species.body_temperature + temp_step*3)
|
||||
else if (bodytemperature >= base_temperature + temp_step*3)
|
||||
bodytemp.icon_state = "temp3"
|
||||
else if (bodytemperature >= species.body_temperature + temp_step*2)
|
||||
else if (bodytemperature >= base_temperature + temp_step*2)
|
||||
bodytemp.icon_state = "temp2"
|
||||
else if (bodytemperature >= species.body_temperature + temp_step*1)
|
||||
else if (bodytemperature >= base_temperature + temp_step*1)
|
||||
bodytemp.icon_state = "temp1"
|
||||
else
|
||||
bodytemp.icon_state = "temp0"
|
||||
|
||||
else if (bodytemperature < species.body_temperature)
|
||||
temp_step = (species.body_temperature - species.cold_level_1)/4
|
||||
else if (bodytemperature < base_temperature)
|
||||
temp_step = (base_temperature - species.cold_level_1)/4
|
||||
|
||||
if (bodytemperature <= species.cold_level_1)
|
||||
bodytemp.icon_state = "temp-4"
|
||||
else if (bodytemperature <= species.body_temperature - temp_step*3)
|
||||
else if (bodytemperature <= base_temperature - temp_step*3)
|
||||
bodytemp.icon_state = "temp-3"
|
||||
else if (bodytemperature <= species.body_temperature - temp_step*2)
|
||||
else if (bodytemperature <= base_temperature - temp_step*2)
|
||||
bodytemp.icon_state = "temp-2"
|
||||
else if (bodytemperature <= species.body_temperature - temp_step*1)
|
||||
else if (bodytemperature <= base_temperature - temp_step*1)
|
||||
bodytemp.icon_state = "temp-1"
|
||||
else
|
||||
bodytemp.icon_state = "temp0"
|
||||
|
||||
Reference in New Issue
Block a user