From 101372ed1139007b9a2866d71aed6b5667a02c2b Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Thu, 13 Feb 2014 21:56:58 -0600 Subject: [PATCH] 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 --- .../mob/living/carbon/human/human_damage.dm | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index d09fa5b20da..20d390b1ba8 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -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("\The [W] sticks in the wound!") - 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("\The [W] sticks in the wound!") + 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) ..()