From 06f2009fbfc8e952003935524c74a232bfccd8b5 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sat, 13 Jun 2015 14:45:13 +0200 Subject: [PATCH] mob/living/Life() now handles environment. --- code/modules/mob/living/carbon/alien/life.dm | 5 +---- code/modules/mob/living/carbon/brain/life.dm | 10 +--------- code/modules/mob/living/carbon/human/life.dm | 6 +----- code/modules/mob/living/carbon/metroid/life.dm | 9 +-------- code/modules/mob/living/life.dm | 7 +++++++ 5 files changed, 11 insertions(+), 26 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index fcdf40c03e..9bd811109e 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -22,9 +22,6 @@ blinded = null - if(loc) - handle_environment(loc.return_air()) - //Status updates, death etc. handle_regular_status_updates() update_canmove() @@ -174,7 +171,7 @@ return 1 -/mob/living/carbon/alien/proc/handle_environment(var/datum/gas_mixture/environment) +/mob/living/carbon/alien/handle_environment(var/datum/gas_mixture/environment) // Both alien subtypes survive in vaccum and suffer in high temperatures, // so I'll just define this once, for both (see radiation comment above) if(!environment) return diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 87a72eb6f3..26064b40ed 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -13,20 +13,12 @@ //Chemicals in the body handle_chemicals_in_body() - var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE - if(loc) - environment = loc.return_air() - //Apparently, the person who wrote this code designed it so that //blinded get reset each cycle and then get activated later in the //code. Very ugly. I dont care. Moving this stuff here so its easy //to find it. blinded = null - //Handle temperature/pressure differences between body and environment - if(environment) // More error checking -- TLE - handle_environment(environment) - //Status updates, death etc. handle_regular_status_updates() update_canmove() @@ -67,7 +59,7 @@ updatehealth() -/mob/living/carbon/brain/proc/handle_environment(datum/gas_mixture/environment) +/mob/living/carbon/brain/handle_environment(datum/gas_mixture/environment) if(!environment) return var/environment_heat_capacity = environment.heat_capacity() diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 7717a912d6..d380b22273 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -51,7 +51,6 @@ //TODO: seperate this out // update the current life tick, can be used to e.g. only do something every 4 ticks life_tick++ - var/datum/gas_mixture/environment = loc.return_air() in_stasis = istype(loc, /obj/structure/closet/body_bag/cryobag) && loc:opened == 0 if(in_stasis) loc:used++ @@ -102,9 +101,6 @@ if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle return //We go ahead and process them 5 times for HUD images and other stuff though. - //Handle temperature/pressure differences between body and environment - handle_environment(environment) //Optimized a good bit. - //Check if we're on fire handle_fire() @@ -577,7 +573,7 @@ breath.update_values() return 1 -/mob/living/carbon/human/proc/handle_environment(datum/gas_mixture/environment) +/mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) if(!environment) return diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index 3c059c62e6..00d28b3a37 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -18,18 +18,11 @@ handle_AI() handle_speech_and_mood() - var/datum/gas_mixture/environment - if(src.loc) - environment = loc.return_air() - regular_hud_updates() - if(environment) - handle_environment(environment) // Handle temperature/pressure differences between body and environment - handle_regular_status_updates() // Status updates, death etc. -/mob/living/carbon/slime/proc/handle_environment(datum/gas_mixture/environment) +/mob/living/carbon/slime/handle_environment(datum/gas_mixture/environment) if(!environment) adjustToxLoss(rand(10,20)) return diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index ef2d88481f..b17b63b8a0 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -14,7 +14,14 @@ . = 1 + //Handle temperature/pressure differences between body and environment + if(environment) + handle_environment(environment) + return . /mob/living/proc/handle_breathing() return + +/mob/living/proc/handle_environment(var/datum/gas_mixture/environment) + return