Merge pull request #5332 from mwerezak/wound-infections

Gives the suit coolers a proper process() proc
This commit is contained in:
Chinsky
2014-06-24 05:32:47 +04:00
2 changed files with 15 additions and 14 deletions

View File

@@ -16,23 +16,28 @@
//TODO: make it heat up the surroundings when not in space //TODO: make it heat up the surroundings when not in space
/obj/item/device/suit_cooling_unit/New() /obj/item/device/suit_cooling_unit/New()
processing_objects |= src
cell = new/obj/item/weapon/cell() //comes with the crappy default power cell - high-capacity ones shouldn't be hard to find cell = new/obj/item/weapon/cell() //comes with the crappy default power cell - high-capacity ones shouldn't be hard to find
cell.loc = src cell.loc = src
/obj/item/device/suit_cooling_unit/proc/cool_mob(mob/M) /obj/item/device/suit_cooling_unit/process()
if (!on || !cell) return if (!on || !cell)
//make sure they have a suit and we are attached to it
if (!attached_to_suit(M))
return return
var/mob/living/carbon/human/H = M if (!ismob(loc))
return
if (!attached_to_suit(loc)) //make sure they have a suit and we are attached to it
return
var/mob/living/carbon/human/H = loc
var/efficiency = H.get_pressure_protection() //you need to have a good seal for effective cooling var/efficiency = H.get_pressure_protection() //you need to have a good seal for effective cooling
var/env_temp = get_environment_temperature() //wont save you from a fire var/env_temp = get_environment_temperature() //wont save you from a fire
var/temp_adj = min(H.bodytemperature - max(thermostat, env_temp), max_cooling) var/temp_adj = min(H.bodytemperature - max(thermostat, env_temp), max_cooling)
if (temp_adj < 0) //only cools, doesn't heat if (temp_adj < 0.5) //only cools, doesn't heat, also we don't need extreme precision
return return
var/charge_usage = (temp_adj/max_cooling)*charge_consumption var/charge_usage = (temp_adj/max_cooling)*charge_consumption
@@ -85,7 +90,8 @@
/obj/item/device/suit_cooling_unit/proc/turn_off() /obj/item/device/suit_cooling_unit/proc/turn_off()
if (ismob(src.loc)) if (ismob(src.loc))
src.loc << "\The [src] clicks and whines as it powers down." //let them know var/mob/M = src.loc
M.show_message("\The [src] clicks and whines as it powers down.", 2) //let them know in case it's run out of power.
on = 0 on = 0
updateicon() updateicon()

View File

@@ -785,13 +785,8 @@
*/ */
proc/stabilize_body_temperature() proc/stabilize_body_temperature()
//TODO find a better place to put this
if (s_store && istype(s_store, /obj/item/device/suit_cooling_unit))
var/obj/item/device/suit_cooling_unit/CU = s_store
CU.cool_mob(src)
if (species.flags & IS_SYNTHETIC) if (species.flags & IS_SYNTHETIC)
bodytemperature += species.synth_temp_gain //that CPU/posibrain just keeps putting out heat. bodytemperature += species.synth_temp_gain //just keep putting out heat.
return return
var/body_temperature_difference = species.body_temperature - bodytemperature var/body_temperature_difference = species.body_temperature - bodytemperature