mob/living/Life() now handles breathing.

This commit is contained in:
PsiOmega
2015-06-13 14:43:25 +02:00
parent ee88e7b8b4
commit 2760836b15
9 changed files with 25 additions and 12 deletions

View File

@@ -15,6 +15,7 @@
#include "code\names.dm" #include "code\names.dm"
#include "code\stylesheet.dm" #include "code\stylesheet.dm"
#include "code\world.dm" #include "code\world.dm"
#include "code\__defines\_compile_options.dm"
#include "code\__defines\admin.dm" #include "code\__defines\admin.dm"
#include "code\__defines\atmos.dm" #include "code\__defines\atmos.dm"
#include "code\__defines\chemistry.dm" #include "code\__defines\chemistry.dm"
@@ -1145,6 +1146,7 @@
#include "code\modules\mob\language\synthetic.dm" #include "code\modules\mob\language\synthetic.dm"
#include "code\modules\mob\living\damage_procs.dm" #include "code\modules\mob\living\damage_procs.dm"
#include "code\modules\mob\living\default_language.dm" #include "code\modules\mob\living\default_language.dm"
#include "code\modules\mob\living\life.dm"
#include "code\modules\mob\living\living.dm" #include "code\modules\mob\living\living.dm"
#include "code\modules\mob\living\living_defense.dm" #include "code\modules\mob\living\living_defense.dm"
#include "code\modules\mob\living\living_defines.dm" #include "code\modules\mob\living\living_defines.dm"

View File

@@ -1,3 +1,6 @@
/mob/living/carbon/brain/handle_breathing()
return
/mob/living/carbon/brain/Life() /mob/living/carbon/brain/Life()
set invisibility = 0 set invisibility = 0
set background = 1 set background = 1
@@ -31,7 +34,6 @@
if(client) if(client)
handle_regular_hud_updates() handle_regular_hud_updates()
/mob/living/carbon/brain/proc/handle_mutations_and_radiation() /mob/living/carbon/brain/proc/handle_mutations_and_radiation()
if (radiation) if (radiation)
if (radiation > 100) if (radiation > 100)

View File

@@ -1,5 +1,10 @@
//Common breathing procs //Common breathing procs
//Start of a breath chain, calls breathe()
/mob/living/carbon/handle_breathing()
if(air_master.current_cycle%4==2 || failed_last_breath || (health < config.health_threshold_crit)) //First, resolve location and get a breath
breathe()
/mob/living/carbon/proc/breathe() /mob/living/carbon/proc/breathe()
//if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return //if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
if(species && (species.flags & NO_BREATHE)) return if(species && (species.flags & NO_BREATHE)) return

View File

@@ -946,7 +946,6 @@
V.cure(src) V.cure(src)
losebreath = 0 losebreath = 0
failed_last_breath = 0 //So mobs that died of oxyloss don't revive and have perpetual out of breath.
..() ..()

View File

@@ -71,8 +71,6 @@
var/miming = null //Toggle for the mime's abilities. var/miming = null //Toggle for the mime's abilities.
var/special_voice = "" // For changing our voice. Used by a symptom. var/special_voice = "" // For changing our voice. Used by a symptom.
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/last_dam = -1 //Used for determining if we need to process all organs or just some or even none. var/last_dam = -1 //Used for determining if we need to process all organs or just some or even none.
var/list/bad_external_organs = list()// organs we check until they are good. var/list/bad_external_organs = list()// organs we check until they are good.

View File

@@ -36,12 +36,10 @@
/mob/living/carbon/human/Life() /mob/living/carbon/human/Life()
set invisibility = 0 set invisibility = 0
set background = 1 set background = BACKGROUND_ENABLED
if (transforming) return if (transforming)
if(!loc) return // Fixing a null error that occurs when the mob isn't found in the world -- TLE return
..()
//Apparently, the person who wrote this code designed it so that //Apparently, the person who wrote this code designed it so that
//blinded get reset each cycle and then get activated later in the //blinded get reset each cycle and then get activated later in the
@@ -65,9 +63,6 @@
//No need to update all of these procs if the guy is dead. //No need to update all of these procs if the guy is dead.
if(stat != DEAD && !in_stasis) if(stat != DEAD && !in_stasis)
if(air_master.current_cycle%4==2 || failed_last_breath || (health < config.health_threshold_crit)) //First, resolve location and get a breath
breathe() //Only try to take a breath every 4 ticks, unless suffocating
//Updates the number of stored chemicals for powers //Updates the number of stored chemicals for powers
handle_changeling() handle_changeling()

View File

@@ -9,6 +9,12 @@
var/datum/gas_mixture/environment = loc.return_air() var/datum/gas_mixture/environment = loc.return_air()
if(stat != DEAD) if(stat != DEAD)
//Breathing, if applicable
handle_breathing()
. = 1 . = 1
return . return .
/mob/living/proc/handle_breathing()
return

View File

@@ -453,6 +453,9 @@ default behaviour is:
BITSET(hud_updateflag, HEALTH_HUD) BITSET(hud_updateflag, HEALTH_HUD)
BITSET(hud_updateflag, STATUS_HUD) BITSET(hud_updateflag, STATUS_HUD)
BITSET(hud_updateflag, LIFE_HUD) BITSET(hud_updateflag, LIFE_HUD)
failed_last_breath = 0 //So mobs that died of oxyloss don't revive and have perpetual out of breath.
return return
/mob/living/proc/UpdateDamageIcon() /mob/living/proc/UpdateDamageIcon()

View File

@@ -43,3 +43,6 @@
var/on_fire = 0 //The "Are we on fire?" var var/on_fire = 0 //The "Are we on fire?" var
var/fire_stacks var/fire_stacks
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.