mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 08:36:00 +01:00
[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:
@@ -156,6 +156,7 @@
|
||||
#include "monkey_business.dm"
|
||||
#include "mouse_bite_cable.dm"
|
||||
#include "mutant_hands_consistency.dm"
|
||||
#include "mutant_organs.dm"
|
||||
#include "novaflower_burn.dm"
|
||||
#include "ntnetwork_tests.dm"
|
||||
#include "nuke_cinematic.dm"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Iterates over all species to ensure that organs are valid after being set to a mutant species
|
||||
*/
|
||||
/datum/unit_test/mutant_organs
|
||||
|
||||
/datum/unit_test/mutant_organs/Run()
|
||||
var/mob/living/carbon/human/consistent/dummy = allocate(/mob/living/carbon/human/consistent)
|
||||
var/list/ignore = list(
|
||||
/datum/species/dullahan,
|
||||
)
|
||||
var/list/species = subtypesof(/datum/species) - ignore
|
||||
var/static/list/organs_we_care_about = list(
|
||||
ORGAN_SLOT_BRAIN,
|
||||
ORGAN_SLOT_HEART,
|
||||
ORGAN_SLOT_LUNGS,
|
||||
ORGAN_SLOT_EYES,
|
||||
ORGAN_SLOT_EARS,
|
||||
ORGAN_SLOT_TONGUE,
|
||||
ORGAN_SLOT_LIVER,
|
||||
ORGAN_SLOT_STOMACH,
|
||||
ORGAN_SLOT_APPENDIX,
|
||||
)
|
||||
|
||||
for(var/datum/species/species_type as anything in species)
|
||||
// change them to the species
|
||||
dummy.set_species(species_type)
|
||||
|
||||
// check all their organs
|
||||
for(var/organ_slot in organs_we_care_about)
|
||||
var/expected_type = slot_to_species_organ_type(organ_slot, species_type)
|
||||
var/obj/item/organ/actual_organ = dummy.getorganslot(organ_slot)
|
||||
if(isnull(actual_organ))
|
||||
if(!isnull(expected_type))
|
||||
TEST_FAIL("[species_type] did not update their [organ_slot] organ to [expected_type], no organ was found")
|
||||
continue
|
||||
else
|
||||
if(isnull(expected_type))
|
||||
TEST_FAIL("[species_type] did not remove their [organ_slot] organ")
|
||||
continue
|
||||
|
||||
if(actual_organ.type != expected_type)
|
||||
TEST_FAIL("[species_type] did not update their [organ_slot] organ to [expected_type], instead it was [actual_organ.type]")
|
||||
continue
|
||||
|
||||
/datum/unit_test/mutant_organs/proc/slot_to_species_organ_type(slot, datum/species/species)
|
||||
switch(slot)
|
||||
if(ORGAN_SLOT_BRAIN)
|
||||
return initial(species.mutantbrain)
|
||||
if(ORGAN_SLOT_HEART)
|
||||
return initial(species.mutantheart)
|
||||
if(ORGAN_SLOT_LUNGS)
|
||||
return initial(species.mutantlungs)
|
||||
if(ORGAN_SLOT_EYES)
|
||||
return initial(species.mutanteyes)
|
||||
if(ORGAN_SLOT_EARS)
|
||||
return initial(species.mutantears)
|
||||
if(ORGAN_SLOT_TONGUE)
|
||||
return initial(species.mutanttongue)
|
||||
if(ORGAN_SLOT_LIVER)
|
||||
return initial(species.mutantliver)
|
||||
if(ORGAN_SLOT_STOMACH)
|
||||
return initial(species.mutantstomach)
|
||||
if(ORGAN_SLOT_APPENDIX)
|
||||
return initial(species.mutantappendix)
|
||||
CRASH("Invalid organ slot [slot]") // just incase someone adds an organ we care about and forgets to add it here
|
||||
Reference in New Issue
Block a user