From fcdf567cc7da940ffd4bee30b66d40f3810e8839 Mon Sep 17 00:00:00 2001 From: distributivgesetz Date: Sun, 24 Sep 2023 02:59:35 +0200 Subject: [PATCH] Hemostat/cautery steps now heal their targetted bodypart instead of a random one (#78380) ## About The Pull Request Title summarizes all. ## Why It's Good For The Game Fixes #48432 @Sealed101 ## Changelog :cl: distributivgesetz fix: Clamping/closing a wound should now heal the bodypart that was damaged instead of a random one. /:cl: --- code/modules/mob/living/carbon/damage_procs.dm | 8 +++++--- code/modules/mob/living/damage_procs.dm | 2 +- code/modules/surgery/organic_steps.dm | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 01551ac0743..6e0c7cef867 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -157,12 +157,14 @@ //////////////////////////////////////////// ///Returns a list of damaged bodyparts -/mob/living/carbon/proc/get_damaged_bodyparts(brute = FALSE, burn = FALSE, required_bodytype) +/mob/living/carbon/proc/get_damaged_bodyparts(brute = FALSE, burn = FALSE, required_bodytype = NONE, target_zone = null) var/list/obj/item/bodypart/parts = list() for(var/X in bodyparts) var/obj/item/bodypart/BP = X if(required_bodytype && !(BP.bodytype & required_bodytype)) continue + if(!isnull(target_zone) && BP.body_zone != target_zone) + continue if((brute && BP.brute_dam) || (burn && BP.burn_dam)) parts += BP return parts @@ -197,8 +199,8 @@ * * It automatically updates health status */ -/mob/living/carbon/heal_bodypart_damage(brute = 0, burn = 0, updating_health = TRUE, required_bodytype) - var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute, burn, required_bodytype) +/mob/living/carbon/heal_bodypart_damage(brute = 0, burn = 0, updating_health = TRUE, required_bodytype = NONE, target_zone = null) + var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute, burn, required_bodytype, target_zone) if(!parts.len) return var/obj/item/bodypart/picked = pick(parts) diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 2cd75c7921a..de2b3398793 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -313,7 +313,7 @@ * * needs to return amount healed in order to calculate things like tend wounds xp gain */ -/mob/living/proc/heal_bodypart_damage(brute = 0, burn = 0, updating_health = TRUE, required_bodytype) +/mob/living/proc/heal_bodypart_damage(brute = 0, burn = 0, updating_health = TRUE, required_bodytype = NONE, target_zone = null) . = (adjustBruteLoss(-brute, FALSE) + adjustFireLoss(-burn, FALSE)) //zero as argument for no instant health update if(updating_health) updatehealth() diff --git a/code/modules/surgery/organic_steps.dm b/code/modules/surgery/organic_steps.dm index a4c087059d6..73e48db857f 100644 --- a/code/modules/surgery/organic_steps.dm +++ b/code/modules/surgery/organic_steps.dm @@ -77,7 +77,7 @@ /datum/surgery_step/clamp_bleeders/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results) if(locate(/datum/surgery_step/saw) in surgery.steps) - target.heal_bodypart_damage(20,0) + target.heal_bodypart_damage(20, 0, target_zone = target_zone) if (ishuman(target)) var/mob/living/carbon/human/human_target = target var/obj/item/bodypart/target_bodypart = human_target.get_bodypart(target_zone) @@ -137,7 +137,7 @@ /datum/surgery_step/close/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results) if(locate(/datum/surgery_step/saw) in surgery.steps) - target.heal_bodypart_damage(45,0) + target.heal_bodypart_damage(45, 0, target_zone = target_zone) if (ishuman(target)) var/mob/living/carbon/human/human_target = target var/obj/item/bodypart/target_bodypart = human_target.get_bodypart(target_zone)