From fced4969805a8b1ddae675127de0b04854c78cea Mon Sep 17 00:00:00 2001 From: Walter0o Date: Sun, 20 Jul 2014 04:21:48 +0200 Subject: [PATCH] fixes simple_animals using FEA instead of ZAS i can't believe after all this time animals still use FEA instead of ZAS. this should fix the "random" animal deaths. --- .../mob/living/simple_animal/simple_animal.dm | 76 +++++++++---------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 906acdbfb2..0360de52b0 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -141,48 +141,42 @@ //Atmos var/atmos_suitable = 1 - var/atom/A = src.loc - if(isturf(A)) - var/turf/T = A - var/areatemp = T.temperature - if( abs(areatemp - bodytemperature) > 40 ) - var/diff = areatemp - bodytemperature - diff = diff / 5 - //world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]" - bodytemperature += diff + var/atom/A = src.loc - if(istype(T,/turf/simulated)) - var/turf/simulated/ST = T - if(ST.air) - var/tox = ST.air.phoron - var/oxy = ST.air.oxygen - var/n2 = ST.air.nitrogen - var/co2 = ST.air.carbon_dioxide - - if(min_oxy) - if(oxy < min_oxy) - atmos_suitable = 0 - if(max_oxy) - if(oxy > max_oxy) - atmos_suitable = 0 - if(min_tox) - if(tox < min_tox) - atmos_suitable = 0 - if(max_tox) - if(tox > max_tox) - atmos_suitable = 0 - if(min_n2) - if(n2 < min_n2) - atmos_suitable = 0 - if(max_n2) - if(n2 > max_n2) - atmos_suitable = 0 - if(min_co2) - if(co2 < min_co2) - atmos_suitable = 0 - if(max_co2) - if(co2 > max_co2) - atmos_suitable = 0 + if(istype(A,/turf)) + var/turf/T = A + + var/datum/gas_mixture/Environment = T.return_air() + + if(Environment) + + if( abs(Environment.temperature - bodytemperature) > 40 ) + bodytemperature += ((Environment.temperature - bodytemperature) / 5) + + if(min_oxy) + if(Environment.oxygen < min_oxy) + atmos_suitable = 0 + if(max_oxy) + if(Environment.oxygen > max_oxy) + atmos_suitable = 0 + if(min_tox) + if(Environment.phoron < min_tox) + atmos_suitable = 0 + if(max_tox) + if(Environment.phoron > max_tox) + atmos_suitable = 0 + if(min_n2) + if(Environment.nitrogen < min_n2) + atmos_suitable = 0 + if(max_n2) + if(Environment.nitrogen > max_n2) + atmos_suitable = 0 + if(min_co2) + if(Environment.carbon_dioxide < min_co2) + atmos_suitable = 0 + if(max_co2) + if(Environment.carbon_dioxide > max_co2) + atmos_suitable = 0 //Atmos effect if(bodytemperature < minbodytemp)