mob/proc/Air()
for(var/area/rooms/spot in oview(0,src))
if(spot.air == 1)
for(var/mob/M in world)
if(M.air_level < 50)
M.air_level ++
else
return
var/oxygen = locate(/obj/hud/oxy) in usr.client.screen
var/obj/hud/oxy/F
if(oxygen)
F.icon_state = "oxy"
if(!oxygen)
var/nooxygen = locate(/obj/hud/nooxy) in usr.client.screen
var/obj/hud/nooxy/E
if(nooxygen)
E.icon_state = "oxy"
if(!nooxygen)
usr<<"Error finding nooxy icon!"
else
for(var/mob/M in world)
M.air_level --
var/oxygen = locate(/obj/hud/oxy) in usr.client.screen
var/obj/hud/oxy/F
if(oxygen)
F.icon_state = "nooxy"
if(!oxygen)
return
if(usr.air_level == 0 && alive == 1)
Dead()
if(alive == 1)
spawn(3)Air()
All right, something I did has to be wrong here. If you go into an area with no air, the icon will change to "nooxy" but will not change back when you are in a spot with air. I can't tell if it's subtracting the air_level either.
EDIT: Oh, by the way some of the stuff that is there that looks repetitive or pointless is there for debugging purposes.
if(var==1)
if(var==0)
usr in proc similar to that one
Things to do:
if(var)
if(!var)
src in proc similar to that one