Skip to content

Commit 5de743e

Browse files
MarsM0ndMarsMond
andauthored
Less invasive chimera regenerate (#7091)
Co-authored-by: MarsMond <no@email>
1 parent 2c636ec commit 5de743e

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

code/modules/mob/living/carbon/human/human-damage-legacy.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ This function restores the subjects blood to max.
343343
This function restores all organs.
344344
*/
345345
/mob/living/carbon/human/restore_all_organs(var/ignore_prosthetic_prefs)
346-
for(var/obj/item/organ/external/current_organ in organs)
346+
for(var/obj/item/organ/current_organ in organs)
347347
current_organ.rejuvenate_legacy(ignore_prosthetic_prefs)
348348

349349
/mob/living/carbon/human/apply_damage(var/damage = 0, var/damagetype = DAMAGE_TYPE_BRUTE, var/def_zone = null, var/blocked = 0, var/soaked = 0, var/sharp = 0, var/edge = 0, var/obj/used_weapon = null)

code/modules/species/station/xenochimera.dm

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,32 @@
668668
return
669669
var/mob/living/carbon/human/H = owner
670670
H.restore_blood()
671-
H.species.create_organs(H, TRUE)
672-
H.restore_all_organs()
673-
H.adjustBruteLoss(-healing_amount)
674-
H.adjustFireLoss(-healing_amount)
671+
//Go through all the organs and limbs we should have, if one's missing, grow it.
672+
for(var/organ_tag in H.species.has_organ)
673+
var/obj/item/organ/I = H.internal_organs_by_name[name]
674+
if(!I)
675+
var/organ_type = H.species.has_organ[organ_tag]
676+
var/obj/item/organ/O = new organ_type(H,1)
677+
if(organ_tag != O.organ_tag)
678+
warning("[O.type] has a default organ tag \"[O.organ_tag]\" that differs from the species' organ tag \"[organ_tag]\". Updating organ_tag to match.")
679+
O.organ_tag = organ_tag
680+
H.internal_organs_by_name[organ_tag] = O
681+
for(var/limb_type in H.species.has_limbs)
682+
var/obj/item/organ/I = H.organs_by_name[limb_type]
683+
if(istype(I, /obj/item/organ/external/stump))
684+
I.removed(null, TRUE)//Shouldn't have a vital stump that can be removed, but no need to kill if that somehow is the case, as it'll be replaced.
685+
I = null
686+
if(!I)
687+
var/list/organ_data = H.species.has_limbs[limb_type]
688+
var/limb_path = organ_data["path"]
689+
var/obj/item/organ/O = new limb_path(H)
690+
organ_data["descriptor"] = O.name
691+
if(O.parent_organ)
692+
organ_data = H.species.has_limbs[O.parent_organ]
693+
organ_data["has_children"] = organ_data["has_children"]+1
694+
H.restore_all_organs(ignore_prosthetic_prefs=TRUE) //A chimera couldn't make a limb robotic by this, shouldn't remove robotic parts, though.
675695
H.adjustOxyLoss(-healing_amount)
676696
H.adjustCloneLoss(-healing_amount)
677-
H.adjustBrainLoss(-healing_amount)
678697
H.remove_status_effect(/datum/status_effect/sight/blindness)
679698
H.eye_blurry = FALSE
680699
H.ear_deaf = FALSE

0 commit comments

Comments
 (0)