From 85661306cdb430334424dbaf119a44a75d06cbe8 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 20 Sep 2020 01:36:54 +0200 Subject: [PATCH] [MIRROR] Attempted fix at dismemberment runtime (#884) * Fixes a dismemberment runtime (#53695) Bunch of undocumented procs relating to wounds. can_dismember is being called on the head from send_item_attack_message after the head is dismembered. At that point is has no owner and we get ourselves a bit of juicy runtime. I suspect it's an order-of-operations issue. The wording of the text messages in send_item_attack_message seem to indicate that it's warning about the attack that is just about to happen. In /mob/living/attacked_by() the very first thing it does is call send_item_attack_message(), before apply_damage. As such, I've made sure send_item_attack_message() is called before apply_damage in this instance too. * Attempted fix at dismemberment runtime Co-authored-by: Timberpoes --- code/modules/mob/living/carbon/human/species.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 0d7461094ef..53044c99b42 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1426,10 +1426,11 @@ GLOBAL_LIST_EMPTY(roundstart_races) Iwound_bonus = CANT_WOUND var/weakness = H.check_weakness(I, user) - apply_damage(I.force * weakness, I.damtype, def_zone, armor_block, H, wound_bonus = Iwound_bonus, bare_wound_bonus = I.bare_wound_bonus, sharpness = I.get_sharpness()) H.send_item_attack_message(I, user, hit_area, affecting) + apply_damage(I.force * weakness, I.damtype, def_zone, armor_block, H, wound_bonus = Iwound_bonus, bare_wound_bonus = I.bare_wound_bonus, sharpness = I.get_sharpness()) + if(!I.force) return FALSE //item force is zero