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.
This commit is contained in:
MrMelbert
2021-09-05 16:24:07 -04:00
committed by GitHub
parent 21b94d5691
commit 76291fe8b1
32 changed files with 69 additions and 50 deletions
+1
View File
@@ -65,6 +65,7 @@
#include "heretic_knowledge.dm"
#include "holidays.dm"
#include "hydroponics_harvest.dm"
#include "hydroponics_self_mutations.dm"
#include "keybinding_init.dm"
#include "machine_disassembly.dm"
#include "medical_wounds.dm"
@@ -0,0 +1,11 @@
/// 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)