Fix Some Bugs With Admin-Reviving Headless Dudes

Admin-reviving a decapitated body will now regrow the head with the ears organ and all the appearance features (hair, eyes, etc.) it used to have according to the mob's DNA.
This commit is contained in:
KasparoVy
2019-08-29 00:34:17 -04:00
parent 5b20a67ed2
commit f30cfd850d
@@ -1096,17 +1096,22 @@
var/limb_path = organ_data["path"]
var/obj/item/organ/external/O = new limb_path(temp_holder)
if(H.get_limb_by_name(O.name)) //Check to see if the user already has an limb with the same name as the 'missing limb'. If they do, skip regrowth.
continue //In an example, this will prevent duplication of the mob's right arm if the mob is a Human and they have a Diona right arm, since,
//while the limb with the name 'right_arm' the mob has may not be listed in their species' bodyparts definition, it is still viable and has the appropriate limb name.
continue //In an example, this will prevent duplication of the mob's right arm if the mob is a Human and they have a Diona right arm, since,
//while the limb with the name 'right_arm' the mob has may not be listed in their species' bodyparts definition, it is still viable and has the appropriate limb name.
else
O = new limb_path(H) //Create the limb on the player.
O.owner = H
H.bodyparts |= H.bodyparts_by_name[O.limb_name]
if(O.body_part == HEAD) //They're sprouting a fresh head so lets hook them up with their genetic stuff so their new head looks like the original.
H.UpdateAppearance()
//Replacing lost organs with the species default.
temp_holder = new /mob/living/carbon/human()
for(var/index in H.dna.species.has_organ)
var/organ = H.dna.species.has_organ[index]
var/list/species_organs = H.dna.species.has_organ.Copy() //Compile a list of species organs and tack on the mutantears afterward.
if(H.dna.species.mutantears)
species_organs["ears"] = H.dna.species.mutantears
for(var/index in species_organs)
var/organ = species_organs[index]
if(!(organ in types_of_int_organs)) //If the mob is missing this particular organ...
var/obj/item/organ/internal/I = new organ(temp_holder) //Create the organ inside our holder so we can check it before implantation.
if(H.get_organ_slot(I.slot)) //Check to see if the user already has an organ in the slot the 'missing organ' belongs to. If they do, skip implantation.