Code effeciency project: handle_embedded_objects

Before:  EVERYTIME someone moved their character this proc would be called and loop through every organ looking for implanted items to see if it needs to apply damage.

After:  We create a flag that is set when an item embeddes, only when that flag is set do we do that loop through organs upon movement.  Also every 10 ticks while that flag
is set we will check to see if we need to unset it.

Conflicts:
	code/modules/mob/living/carbon/human/human_damage.dm
This commit is contained in:
Ccomp5950
2014-02-19 19:26:04 -05:00
committed by ZomgPonies
parent 9d7356cd06
commit 101372ed11
@@ -248,17 +248,19 @@
if(istype(used_weapon,/obj/item/weapon))
var/obj/item/weapon/W = used_weapon //Sharp objects will always embed if they do enough damage.
if( (damage > (10*W.w_class)) && ( (sharp && !ismob(W.loc)) || prob(damage/W.w_class) ) )
if(!istype(W, /obj/item/weapon/butch/meatcleaver))
organ.implants += W
visible_message("<span class='danger'>\The [W] sticks in the wound!</span>")
embedded_flag = 1
src.verbs += /mob/proc/yank_out_object
W.add_blood(src)
if(ismob(W.loc))
var/mob/living/H = W.loc
H.drop_item()
W.loc = src
organ.implants += W
visible_message("<span class='danger'>\The [W] sticks in the wound!</span>")
embedded_flag = 1
src.verbs += /mob/proc/yank_out_object
W.add_blood(src)
if(ismob(W.loc))
var/mob/living/H = W.loc
H.drop_item()
W.loc = src
return 1
// incredibly important stuff follows
/mob/living/carbon/human/fall(var/forced)
..()