diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 6497d8a2178..1b5ae2e763c 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -1,3 +1,8 @@ +#define SHEATER_OFF 0 +#define SHEATER_STANDBY 1 +#define SHEATER_HEAT 2 +#define SHEATER_COOL 3 + /obj/machinery/space_heater anchored = 0 density = 1 @@ -5,9 +10,15 @@ icon_state = "sheater0" name = "space heater" desc = "Made by Space Amish using traditional space techniques, this heater is guaranteed not to set the station on fire." + + light_system = MOVABLE_LIGHT + light_range = 3 + light_power = 1 + light_on = FALSE + var/obj/item/weapon/cell/cell var/cell_type = /obj/item/weapon/cell/high - var/on = 0 + var/state = 0 var/set_temperature = T0C + 20 //K var/heating_power = 40000 clicksound = "switch" @@ -21,18 +32,25 @@ /obj/machinery/space_heater/update_icon() cut_overlays() - icon_state = "sheater[on]" + icon_state = "sheater[state]" if(panel_open) add_overlay("sheater-open") - if(on) - set_light(3, 3, "#FFCC00") - else - set_light(0) + switch(state) + if(SHEATER_OFF) + set_light_on(FALSE) + if(SHEATER_STANDBY) + set_light_on(FALSE) + if(SHEATER_HEAT) + set_light_color("#FFCC00") + set_light_on(TRUE) + if(SHEATER_COOL) + set_light_color("#00ccff") + set_light_on(TRUE) /obj/machinery/space_heater/examine(mob/user) . = ..() - . += "The heater is [on ? "on" : "off"] and the hatch is [panel_open ? "open" : "closed"]." + . += "The heater is [state ? "on" : "off"] and the hatch is [panel_open ? "open" : "closed"]." if(panel_open) . += "The power cell is [cell ? "installed" : "missing"]." else @@ -92,8 +110,8 @@ if(panel_open) tgui_interact(user) else - on = !on - user.visible_message("[user] switches [on ? "on" : "off"] the [src].","You switch [on ? "on" : "off"] the [src].") + state = state ? SHEATER_OFF : SHEATER_STANDBY + user.visible_message("[user] switches [state ? "on" : "off"] the [src].","You switch [state ? "on" : "off"] the [src].") update_icon() return @@ -159,34 +177,47 @@ . = TRUE /obj/machinery/space_heater/process() - if(on) - if(cell && cell.charge) - var/datum/gas_mixture/env = loc.return_air() - if(env && abs(env.temperature - set_temperature) > 0.1) - var/transfer_moles = 0.25 * env.total_moles - var/datum/gas_mixture/removed = env.remove(transfer_moles) + if(!state) + return - if(removed) - var/heat_transfer = removed.get_thermal_energy_change(set_temperature) - if(heat_transfer > 0) //heating air - heat_transfer = min(heat_transfer , heating_power) //limit by the power rating of the heater + if(cell && cell.charge) + var/datum/gas_mixture/env = loc.return_air() + if(env && abs(env.temperature - set_temperature) > 0.1) + var/transfer_moles = 0.25 * env.total_moles + var/datum/gas_mixture/removed = env.remove(transfer_moles) - removed.add_thermal_energy(heat_transfer) - cell.use(heat_transfer*CELLRATE) - else //cooling air - heat_transfer = abs(heat_transfer) + if(removed) + var/heat_transfer = removed.get_thermal_energy_change(set_temperature) + if(heat_transfer > 0) //heating air + if(state == SHEATER_STANDBY) + state = SHEATER_HEAT + update_icon() + heat_transfer = min(heat_transfer , heating_power) //limit by the power rating of the heater - //Assume the heat is being pumped into the hull which is fixed at 20 C - var/cop = removed.temperature/T20C //coefficient of performance from thermodynamics -> power used = heat_transfer/cop - heat_transfer = min(heat_transfer, cop * heating_power) //limit heat transfer by available power + removed.add_thermal_energy(heat_transfer) + cell.use(heat_transfer*CELLRATE) + else //cooling air + if(state == SHEATER_STANDBY) + state = SHEATER_COOL + update_icon() + heat_transfer = abs(heat_transfer) - heat_transfer = removed.add_thermal_energy(-heat_transfer) //get the actual heat transfer + //Assume the heat is being pumped into the hull which is fixed at 20 C + var/cop = removed.temperature/T20C //coefficient of performance from thermodynamics -> power used = heat_transfer/cop + heat_transfer = min(heat_transfer, cop * heating_power) //limit heat transfer by available power - var/power_used = abs(heat_transfer)/cop - cell.use(power_used*CELLRATE) + heat_transfer = removed.add_thermal_energy(-heat_transfer) //get the actual heat transfer - env.merge(removed) - else - on = 0 - power_change() - update_icon() + var/power_used = abs(heat_transfer)/cop + cell.use(power_used*CELLRATE) + + env.merge(removed) + else + state = SHEATER_OFF + power_change() + update_icon() + +#undef SHEATER_OFF +#undef SHEATER_STANDBY +#undef SHEATER_HEAT +#undef SHEATER_COOL \ No newline at end of file diff --git a/code/game/objects/stumble_into_vr.dm b/code/game/objects/stumble_into_vr.dm index 2a747ae5636..e52a2f6ce5f 100644 --- a/code/game/objects/stumble_into_vr.dm +++ b/code/game/objects/stumble_into_vr.dm @@ -116,7 +116,7 @@ /obj/machinery/space_heater/stumble_into(mob/living/M) ..() - if(on) + if(state) M.apply_damage(10, BURN) M.emote("scream") diff --git a/icons/obj/atmos.dmi b/icons/obj/atmos.dmi index 13f177d3009..fe5b010474c 100644 Binary files a/icons/obj/atmos.dmi and b/icons/obj/atmos.dmi differ