[MIRROR] Resolves mutant species keeping old organs they shouldn't have [MDB IGNORE] (#19958)

* Resolves mutant species keeping old organs they shouldn't have (#73728)

## About The Pull Request

regenerate organs never removed invalid organs when regenerating
## Why It's Good For The Game

Fixes https://github.com/tgstation/tgstation/issues/73640
adds a unit test to prevent regressions in the future

## Changelog
🆑
fix: Plasmamen don't have hearts, again
/🆑

* Resolves mutant species keeping old organs they shouldn't have

* https://github.com/tgstation/tgstation/pull/68168

* Now everything should pass, yes, even appendixes for synths

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
Co-authored-by: Coffee <CoffeeDragon16@gmail.com>
This commit is contained in:
SkyratBot
2023-03-26 19:28:28 +02:00
committed by GitHub
parent 45a3020827
commit d4c8a4ed9e
17 changed files with 106 additions and 25 deletions
@@ -172,9 +172,9 @@ GLOBAL_LIST_EMPTY(features_by_species)
///What anim to use for gibbing
var/gib_anim = "gibbed-h"
//Do NOT remove by setting to null. use OR make an ASSOCIATED TRAIT.
//why does it work this way? because traits also disable the downsides of not having an organ, removing organs but not having the trait will make your species die
// Prefer anything other than setting these to null, such as TRAITS
// why?
// because traits also disable the downsides of not having an organ, removing organs but not having the trait or logic will make your species die
///Replaces default brain with a different organ
var/obj/item/organ/internal/brain/mutantbrain = /obj/item/organ/internal/brain
@@ -350,6 +350,9 @@ GLOBAL_LIST_EMPTY(features_by_species)
var/obj/item/organ/oldorgan = C.getorganslot(slot) //used in removing
var/obj/item/organ/neworgan = slot_mutantorgans[slot] //used in adding
if(!neworgan) //these can be null, if so we shouldn't regenerate
if(oldorgan) // although we also need to remove the old organ if it exists
oldorgan.Remove(C, special=TRUE)
qdel(oldorgan)
continue
if(visual_only && !initial(neworgan.visual))
@@ -367,7 +370,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
* - The replaced organ is not in an excluded zone
* - The replaced organ is not unremovable or synthetic (an implant)
*/
if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && !(oldorgan.organ_flags & (ORGAN_UNREMOVABLE|ORGAN_SYNTHETIC)))
if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && (!(oldorgan.organ_flags & (ORGAN_UNREMOVABLE|ORGAN_SYNTHETIC)) || (oldorgan.organ_flags & ORGAN_SYNTHETIC_FROM_SPECIES))) // SKYRAT EDIT - Customization - ORIGINAL: if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && !(oldorgan.organ_flags & (ORGAN_UNREMOVABLE|ORGAN_SYNTHETIC)))
if(slot == ORGAN_SLOT_BRAIN)
var/obj/item/organ/internal/brain/brain = oldorgan
if(!brain.decoy_override)//"Just keep it if it's fake" - confucius, probably
@@ -25,7 +25,6 @@
mutantlungs = null
inherent_biotypes = MOB_HUMANOID|MOB_MINERAL
mutant_organs = list(/obj/item/organ/internal/adamantine_resonator)
mutanttongue = /obj/item/organ/internal/vocal_cords/adamantine
speedmod = 2
payday_modifier = 0.75
armor = 55
@@ -88,8 +87,7 @@
name = "Adamantine Golem"
id = SPECIES_GOLEM_ADAMANTINE
meat = /obj/item/food/meat/slab/human/mutant/golem/adamantine
mutant_organs = list(/obj/item/organ/internal/adamantine_resonator)
mutanttongue = /obj/item/organ/internal/vocal_cords/adamantine
mutant_organs = list(/obj/item/organ/internal/adamantine_resonator, /obj/item/organ/internal/vocal_cords/adamantine)
fixed_mut_color = "#44eedd"
info_text = "As an <span class='danger'>Adamantine Golem</span>, you possess special vocal cords allowing you to \"resonate\" messages to all golems. Your unique mineral makeup makes you immune to most types of magic."
prefix = "Adamantine"