From fca1e61371c67371174cfb77e97f44c01fc4e8ce Mon Sep 17 00:00:00 2001 From: Artemchik542 <32270644+Artemchik542@users.noreply.github.com> Date: Sat, 17 May 2025 12:40:49 +0700 Subject: [PATCH] Quirk "quadruple amputee" now will return your original limbs back if you off it (#90745) ## About The Pull Request Then you try to remove quirk - your limbs didn't change back to normal **Visual bug only**, originally found on downstream. Also confirmed on up-to-date TG-localhost ![error](https://github.com/user-attachments/assets/33c280d2-9aa9-4ccc-bca2-3977a2e723de) ## Why It's Good For The Game Bug-Fix always good ## Changelog :cl: fix: Quirk "quadruple amputee" now will return your original limbs back if you off it qol: Quirk "prosthetic limb" now resets more correctly /:cl: --------- Co-authored-by: Maximal08 <73069825+Maximal08@users.noreply.github.com> Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> --- .../quirks/negative_quirks/prosthetic_limb.dm | 13 +++++++------ .../negative_quirks/quadruple_amputee.dm | 10 ++++++++++ code/modules/surgery/bodyparts/helpers.dm | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/code/datums/quirks/negative_quirks/prosthetic_limb.dm b/code/datums/quirks/negative_quirks/prosthetic_limb.dm index a9917ac0a59..cd4869cf26e 100644 --- a/code/datums/quirks/negative_quirks/prosthetic_limb.dm +++ b/code/datums/quirks/negative_quirks/prosthetic_limb.dm @@ -8,24 +8,26 @@ mail_goodies = list(/obj/item/weldingtool/mini, /obj/item/stack/cable_coil/five) /// The slot to replace, in string form var/slot_string = "limb" - /// the original limb from before the prosthetic was applied - var/obj/item/bodypart/old_limb + /// The slot to replace, in GLOB.limb_zones (both arms and both legs) + var/limb_zone + /datum/quirk_constant_data/prosthetic_limb associated_typepath = /datum/quirk/prosthetic_limb customization_options = list(/datum/preference/choiced/prosthetic) /datum/quirk/prosthetic_limb/add_unique(client/client_source) - var/limb_type = GLOB.prosthetic_limb_choice[client_source?.prefs?.read_preference(/datum/preference/choiced/prosthetic)] + var/obj/item/bodypart/limb_type = GLOB.prosthetic_limb_choice[client_source?.prefs?.read_preference(/datum/preference/choiced/prosthetic)] if(isnull(limb_type)) //Client gone or they chose a random prosthetic limb_type = GLOB.prosthetic_limb_choice[pick(GLOB.prosthetic_limb_choice)] + limb_zone = limb_type.body_zone var/mob/living/carbon/human/human_holder = quirk_holder var/obj/item/bodypart/surplus = new limb_type() slot_string = "[surplus.plaintext_zone]" medical_record_text = "Patient uses a low-budget prosthetic on the [slot_string]." - old_limb = human_holder.return_and_replace_bodypart(surplus, special = TRUE) + human_holder.del_and_replace_bodypart(surplus, special = TRUE) /datum/quirk/prosthetic_limb/post_add() to_chat(quirk_holder, span_bolddanger("Your [slot_string] has been replaced with a surplus prosthetic. It has almost no muscle force, and makes you unhealthier by just having it. Additionally, \ @@ -33,5 +35,4 @@ /datum/quirk/prosthetic_limb/remove() var/mob/living/carbon/human/human_holder = quirk_holder - human_holder.del_and_replace_bodypart(old_limb, special = TRUE) - old_limb = null + human_holder.reset_to_original_bodypart(limb_zone) diff --git a/code/datums/quirks/negative_quirks/quadruple_amputee.dm b/code/datums/quirks/negative_quirks/quadruple_amputee.dm index 653cca3dccd..716ec9ef239 100644 --- a/code/datums/quirks/negative_quirks/quadruple_amputee.dm +++ b/code/datums/quirks/negative_quirks/quadruple_amputee.dm @@ -18,3 +18,13 @@ /datum/quirk/quadruple_amputee/post_add() to_chat(quirk_holder, span_bolddanger("All your limbs have been replaced with surplus prosthetics. They are fragile and will easily come apart under duress. \ Additionally, you need to use a welding tool and cables to repair them, instead of bruise packs and ointment.")) + +/datum/quirk/quadruple_amputee/remove() + if(QDELING(quirk_holder)) + return + + var/mob/living/carbon/human/human_holder = quirk_holder + human_holder.reset_to_original_bodypart(BODY_ZONE_L_ARM) + human_holder.reset_to_original_bodypart(BODY_ZONE_R_ARM) + human_holder.reset_to_original_bodypart(BODY_ZONE_L_LEG) + human_holder.reset_to_original_bodypart(BODY_ZONE_R_LEG) diff --git a/code/modules/surgery/bodyparts/helpers.dm b/code/modules/surgery/bodyparts/helpers.dm index 2a70b38afe2..22b9411b645 100644 --- a/code/modules/surgery/bodyparts/helpers.dm +++ b/code/modules/surgery/bodyparts/helpers.dm @@ -29,6 +29,24 @@ new_limb.try_attach_limb(src, special = special) return old_limb // can be null +/// Replaces the chosen limb(zone) to the original one +/mob/living/carbon/proc/reset_to_original_bodypart(limb_zone) + if (!(limb_zone in GLOB.all_body_zones)) + stack_trace("Invalid zone [limb_zone] provided to reset_to_original_bodypart()") + return + + // find old limb to del it first + var/obj/item/bodypart/old_limb = get_bodypart(limb_zone) + if(old_limb) + old_limb.drop_limb(special = TRUE) + qdel(old_limb) + + // mаke and attach the original limb + var/obj/item/bodypart/original_limb = newBodyPart(limb_zone) + original_limb.try_attach_limb(src, TRUE) + original_limb.update_limb(is_creating = TRUE) + regenerate_icons() + /mob/living/carbon/has_hand_for_held_index(i) if(!i) return FALSE