diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index b2eea3bddeb..5a27072f023 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -8,7 +8,9 @@ use_power = POWER_USE_OFF clicksound = /singleton/sound_category/switch_sound var/on = FALSE + /// Currently heating or cooling the environment, if on. var/active = 0 + /// Force it to at least somewhat obey thermodynamics. var/heating_power = 40 KILO WATTS var/current_temperature var/set_temperature = T0C + 20 @@ -28,6 +30,8 @@ /obj/machinery/space_heater/Initialize() . = ..() cell = new(src) + /// Ensure env exists so TGUI doesn't attempt to round null for display. + env = loc.return_air() update_icon() /obj/machinery/space_heater/update_icon() @@ -112,13 +116,15 @@ /obj/machinery/space_heater/ui_data(mob/user) var/list/data = list() + current_temperature = round(env.temperature - T0C, 0.1) + data["power_cell_inserted"] = cell data["power_cell_charge"] = cell?.percent() data["is_on"] = on data["is_active"] = active data["panel_open"] = panel_open data["heating_power"] = heating_power - data["current_temperature"] = round(env.temperature - T0C, 0.1) + data["current_temperature"] = current_temperature data["set_temperature"] = set_temperature - T0C data["set_temperature_max"] = set_temperature_max - T0C data["set_temperature_min"] = set_temperature_min - T0C diff --git a/html/changelogs/bat-spaceheatercrashfix.yml b/html/changelogs/bat-spaceheatercrashfix.yml new file mode 100644 index 00000000000..32a4a35947f --- /dev/null +++ b/html/changelogs/bat-spaceheatercrashfix.yml @@ -0,0 +1,13 @@ +# Your name. +author: Batrachophrenoboocosmomachia + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Space heater gets env data on init for safety, to avoid TGUI edge case crash from attempting to round a null value."