mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 19:17:50 +01:00
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:
@@ -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)
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user