mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 11:42:27 +00:00
## About The Pull Request Refactors regenerate organs to be slightly more intelligent in handling organ changes and replacements. Noteably: - We don't remove organs that were modified by the owner; such as changing out your heart for a cybernetic - We early break out of the for loop if they aren't supposed to have an organ there and remove it - We check for the organ already being correct, and just healing it and continuing if it is Also changes the names of some of the organ helpers into snake_case ### Mapping March Ckey to receive rewards: N/A ## Why It's Good For The Game ## Changelog --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
/**
|
|
* 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/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)
|
|
// get our dummy
|
|
var/mob/living/carbon/human/consistent/dummy = allocate(/mob/living/carbon/human/consistent)
|
|
|
|
// 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 = dummy.dna.species.get_mutant_organ_type_for_slot(organ_slot)
|
|
var/obj/item/organ/actual_organ = dummy.get_organ_slot(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
|