adds a unique species id unit test + cleans up some golem mischief (#66050)

This commit is contained in:
capsaicin
2022-04-11 00:33:24 -05:00
committed by GitHub
parent 0e805709e0
commit abc2109a5d
6 changed files with 35 additions and 24 deletions
+1
View File
@@ -108,6 +108,7 @@
#include "spawn_humans.dm"
#include "spawn_mobs.dm"
#include "species_config_sanity.dm"
#include "species_unique_id.dm"
#include "species_whitelists.dm"
#include "stomach.dm"
#include "strippable.dm"
@@ -0,0 +1,14 @@
/**
* Every species should use a species ID unique to it and it alone. This test runs through every subtype of /datum/species, and checks for a species ID.
* Every ID is written to a list, gathered_species_ids, and if a previously written ID is written again, this test will fail.
*/
/datum/unit_test/species_unique_id
/datum/unit_test/species_unique_id/Run()
var/list/gathered_species_ids = list()
for(var/datum/species/species as anything in subtypesof(/datum/species))
var/species_id = initial(species.id)
if(gathered_species_ids[species_id])
Fail("Duplicate species ID! [species_id] is not unique to a single species.")
else
gathered_species_ids[species_id] = TRUE