mob/living/Life() now handles environment.

This commit is contained in:
PsiOmega
2015-06-13 14:45:13 +02:00
parent 2760836b15
commit 06f2009fbf
5 changed files with 11 additions and 26 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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