Code effeciency project: Handle_Organs (human/life())

We do a bit of pre-processing to see if we want to do checks on all the organs.

First we don't even do preprocessing unless we have damage of some kind
afterwards we process what is hurt until it gets better or overall we get worse
when we go ahead and check everything else out again.

Can add a safety check in life every 30 ticks or so go ahead and check every organ again but I don't think it's needed.

Conflicts:
	code/modules/mob/living/carbon/human/human_defines.dm
	code/modules/mob/living/carbon/human/life.dm
	code/modules/organs/organ.dm
This commit is contained in:
Ccomp5950
2014-03-23 08:02:45 -04:00
committed by ZomgPonies
parent 73090b72cf
commit 4c274837d4
4 changed files with 79 additions and 44 deletions
@@ -51,6 +51,9 @@
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/list/bad_external_organs = list()// organs we check until they are good.
var/xylophone = 0 //For the spoooooooky xylophone cooldown
var/mob/remoteview_target = null
@@ -61,4 +64,3 @@
var/check_mutations=0 // Check mutations on next life tick
var/lastFart = 0 // Toxic fart cooldown.
+7 -4
View File
@@ -1066,7 +1066,7 @@
updatehealth() //TODO
if(!in_stasis)
handle_organs()
handle_organs() //Optimized.
handle_blood()
if(health <= config.health_threshold_dead || brain_op_stage == 4.0)
@@ -1228,20 +1228,23 @@
if(stuttering)
stuttering = max(stuttering-1, 0)
if (src.slurring)
slurring = max(slurring-(1*sober_str), 0)
if (slurring)
slurring = max(slurring-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
/*
// Increase germ_level regularly
if(prob(40))
germ_level += 1
// If you're dirty, your gloves will become dirty, too.
if(gloves && germ_level > gloves.germ_level && prob(10))
gloves.germ_level += 1
*/
return 1
proc/handle_regular_hud_updates()