Files
Bubberstation/code/modules/unit_tests/hydroponics_self_mutations.dm
MrMelbert 76291fe8b1 Fixes + unit tests botany plants mutating into themselves, and makes mutatelists proper lazylists (#61235)
- This PR fixes a few botany plants mutating into themselves due to seeds inheriting the mutation list from its parent. Durathread, Jupiter Cups, Fairy Grass, Red Onions, Bamboo, Green Grapes, and World Peas (maybe some others I forgot). 
- This PR also unit tests to ensure plants don't mutate into themselves. 
- This PR also converts mutatelist into a proper lazylist. IT was already kinda a lazy list, in that it's null by default, but for some reason it was treated as a normal list in multiple places.
2021-09-05 16:24:07 -04:00

12 lines
531 B
Plaintext

/// Unit test to ensure plants can't self-mutate into themselves.
/datum/unit_test/hydroponics_self_mutation
/datum/unit_test/hydroponics_self_mutation/Run()
var/list/all_seeds = subtypesof(/obj/item/seeds)
for(var/seed in all_seeds)
var/obj/item/seeds/instantiated_seed = new seed()
for(var/path in instantiated_seed.mutatelist)
TEST_ASSERT(!istype(instantiated_seed, path), "[instantiated_seed] - [instantiated_seed.type] is able to mutate into itself! Its mutatelist is not set correctly.")
qdel(instantiated_seed)