diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 1868c8cff46..6423979410d 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1024,9 +1024,6 @@ /mob/living/carbon/human/species/golem race = /datum/species/golem -/mob/living/carbon/human/species/golem/random - race = /datum/species/golem/random - /mob/living/carbon/human/species/golem/adamantine race = /datum/species/golem/adamantine diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 05518cee211..eb8e23fcdfb 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -83,24 +83,6 @@ return to_add -/datum/species/golem/random - name = "Random Golem" - changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | RACE_SWAP | ERT_SPAWN - var/static/list/random_golem_types - -/datum/species/golem/random/on_species_gain(mob/living/carbon/C, datum/species/old_species) - ..() - if(!random_golem_types) - random_golem_types = subtypesof(/datum/species/golem) - type - for(var/V in random_golem_types) - var/datum/species/golem/G = V - if(!initial(G.random_eligible)) - random_golem_types -= G - var/datum/species/golem/golem_type = pick(random_golem_types) - var/mob/living/carbon/human/H = C - H.set_species(golem_type) - to_chat(H, "[initial(golem_type.info_text)]") - /datum/species/golem/adamantine name = "Adamantine Golem" id = SPECIES_GOLEM_ADAMANTINE diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 3ab8b9a5448..afcd6a39156 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -653,10 +653,20 @@ name = "Golem Mutation Toxin" description = "A crystal toxin." color = "#5EFF3B" //RGB: 94, 255, 59 - race = /datum/species/golem/random + race = /datum/species/golem taste_description = "rocks" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE +/datum/reagent/mutationtoxin/golem/on_mob_metabolize() + var/static/list/random_golem_types + random_golem_types = subtypesof(/datum/species/golem) - type + for(var/i in random_golem_types) + var/datum/species/golem/golem = i + if(!initial(golem.random_eligible)) + random_golem_types -= golem + race = pick(random_golem_types) + ..() + /datum/reagent/mutationtoxin/abductor name = "Abductor Mutation Toxin" description = "An alien toxin." diff --git a/code/modules/research/xenobiology/crossbreeding/chilling.dm b/code/modules/research/xenobiology/crossbreeding/chilling.dm index 09c22a92b08..3015bfd6a79 100644 --- a/code/modules/research/xenobiology/crossbreeding/chilling.dm +++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm @@ -295,13 +295,20 @@ Chilling extracts: /obj/item/slimecross/chilling/black colour = "black" - effect_desc = "Transforsms the user into a random type of golem." + effect_desc = "Transforms the user into a random type of golem." /obj/item/slimecross/chilling/black/do_effect(mob/user) if(ishuman(user)) user.visible_message(span_notice("[src] crystallizes along [user]'s skin, turning into metallic scales!")) var/mob/living/carbon/human/H = user - H.set_species(/datum/species/golem/random) + + var/static/list/random_golem_types + random_golem_types = subtypesof(/datum/species/golem) - type + + for(var/datum/species/golem/golem as anything in random_golem_types) + if(!initial(golem.random_eligible)) + random_golem_types -= golem + H.set_species(pick(random_golem_types)) ..() /obj/item/slimecross/chilling/lightpink diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index d419695237a..740a3927e83 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -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" diff --git a/code/modules/unit_tests/species_unique_id.dm b/code/modules/unit_tests/species_unique_id.dm new file mode 100644 index 00000000000..9bf8052e9ff --- /dev/null +++ b/code/modules/unit_tests/species_unique_id.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