Files
Bubberstation/code/modules/unit_tests/species_change_organs.dm
T
b79167c173 [MIRROR] Organ movement refactor *Un-nullspaces your organs* [MDB IGNORE] (#25530)
* Organ movement refactor *Un-nullspaces your organs*

* Fix conflicts

I checked the conflicts on the two weird conflicts and no previous TG pr touches them i assume its just github being github because those shoulden't be conflicts *shrug

* Fix #1 uhh...this is going to be a long one

* Fix #2 Modular Movement Flags

* Fix #3 It builds now

* Fix #4 Oh god it builds now, I missed some things

* Fix #5 No more Runtimesplosion Now time for Synths

* Update nightmare_organs.dm

* on_mob_insert

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/25664

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/25685

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/25582

* https://github.com/Skyrat-SS13/Skyrat-tg/pull/25686

* bro the fucking brain does not go into the chest.

* seriously? undocumented code causing shit. if it breaks ghouls, so be it.

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: SomeRandomOwl <somerandomowl@ratchtnet.com>
Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2023-12-24 19:06:09 +00:00

47 lines
2.3 KiB
Plaintext

/**
* Unit test to ensure that, when a mob changes species,
* certain aspects are carried over between their old and new set of organs
* (brain traumas, cybernetics, and organ damage)
*/
/datum/unit_test/species_change_organs
/datum/unit_test/species_change_organs/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
// Give a trauma
dummy.gain_trauma(/datum/brain_trauma/severe/blindness)
// Give a cyber heart
var/obj/item/organ/internal/heart/cybernetic/cyber_heart = allocate(/obj/item/organ/internal/heart/cybernetic)
cyber_heart.Insert(dummy, special = TRUE, movement_flags = DELETE_IF_REPLACED)
// Give one of their organs a bit of damage
var/obj/item/organ/internal/appendix/existing_appendix = dummy.get_organ_slot(ORGAN_SLOT_APPENDIX)
existing_appendix.set_organ_damage(25)
// Changing species should
// - Persist brain traumas
// - Persist cybernetic implants
// - Persist organ damage to identical types
// Set up a species to pass over
var/datum/species/lizard/changed_species = new()
// But make sure the lizard's mutant organs are "normal"
changed_species.mutantheart = dummy.dna.species.mutantheart
changed_species.mutantappendix = dummy.dna.species.mutantappendix
// and make sure they're not a TRAIT_NOBLOOD species so they need a heart
changed_species.inherent_traits -= TRAIT_NOBLOOD
// Now make them a lizard
dummy.set_species(changed_species)
TEST_ASSERT(istype(dummy.dna.species, /datum/species/lizard), "Dummy didn't transform into a lizard when testing species organ changes.")
// Grab the lizard's appendix for comparison later
// They should've been given a new one, but our damage should also have transferred over
var/obj/item/organ/internal/appendix/lizard_appendix = dummy.get_organ_slot(ORGAN_SLOT_APPENDIX)
// They should have the trauma still
TEST_ASSERT(dummy.has_trauma_type(/datum/brain_trauma/severe/blindness), "Dummy, upon changing species, did not carry over their brain trauma!")
// They should have their cybernetic heart still
TEST_ASSERT_EQUAL(dummy.get_organ_slot(ORGAN_SLOT_HEART), cyber_heart, "Dummy, upon changing species, did not carry over their cybernetic organs!")
// They should have appendix damage still
TEST_ASSERT_EQUAL(lizard_appendix.damage, 25, "Dummy, upon changing species, did not carry over appendix damage!")