Adds a unit test for species changes keeping clothings (#69788)

* Adds a unit test for species changes keeping clothings

Adds a unit test that checks if people who species change into a Lizard keeps their non-digitigrade shoes or not, which will also affect Monkeys.
This commit is contained in:
John Willard
2022-09-13 19:10:33 -07:00
committed by GitHub
parent 97ad150115
commit 8e656a57f3
6 changed files with 35 additions and 3 deletions
+3
View File
@@ -124,6 +124,9 @@
///The species is forced to have digitigrade legs in generation.
#define DIGITIGRADE_FORCED 2
///Digitigrade's prefs, used in features for legs if you're meant to be a Digitigrade.
#define DIGITIGRADE_LEGS "Digitigrade Legs"
//TODO: Remove entirely in favor of the BODYTYPE system
///Body type bitfields for allowed_animal_origin used to check compatible surgery body types (use NONE for no matching body type)
#define HUMAN_BODY (1 << 0)
+13 -1
View File
@@ -708,7 +708,19 @@
switch(random)
if(1)
to_chat(user, span_danger("Your appearance morphs to that of a very small humanoid ash dragon! You get to look like a freak without the cool abilities."))
consumer.dna.features = list("mcolor" = "#A02720", "tail_lizard" = "Dark Tiger", "tail_human" = "None", "snout" = "Sharp", "horns" = "Curled", "ears" = "None", "wings" = "None", "frills" = "None", "spines" = "Long", "body_markings" = "Dark Tiger Body", "legs" = "Digitigrade Legs")
consumer.dna.features = list(
"mcolor" = "#A02720",
"tail_lizard" = "Dark Tiger",
"tail_human" = "None",
"snout" = "Sharp",
"horns" = "Curled",
"ears" = "None",
"wings" = "None",
"frills" = "None",
"spines" = "Long",
"body_markings" = "Dark Tiger Body",
"legs" = DIGITIGRADE_LEGS,
)
consumer.eye_color_left = "#FEE5A3"
consumer.eye_color_right = "#FEE5A3"
consumer.set_species(/datum/species/lizard)
@@ -2049,7 +2049,7 @@
name = "Normal Legs"
/datum/sprite_accessory/legs/digitigrade_lizard
name = "Digitigrade Legs"
name = DIGITIGRADE_LEGS
/datum/sprite_accessory/caps
icon = 'icons/mob/species/mutant_bodyparts.dmi'
@@ -2217,7 +2217,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
new_species ||= target.dna.species //If no new species is provided, assume its src.
//Note for future: Potentionally add a new C.dna.species() to build a template species for more accurate limb replacement
if((new_species.digitigrade_customization == DIGITIGRADE_OPTIONAL && target.dna.features["legs"] == "Digitigrade Legs") || new_species.digitigrade_customization == DIGITIGRADE_FORCED)
if((new_species.digitigrade_customization == DIGITIGRADE_OPTIONAL && target.dna.features["legs"] == DIGITIGRADE_LEGS) || new_species.digitigrade_customization == DIGITIGRADE_FORCED)
new_species.bodypart_overrides[BODY_ZONE_R_LEG] = /obj/item/bodypart/r_leg/digitigrade
new_species.bodypart_overrides[BODY_ZONE_L_LEG] = /obj/item/bodypart/l_leg/digitigrade
+1
View File
@@ -151,6 +151,7 @@
#include "slips.dm"
#include "spawn_humans.dm"
#include "spawn_mobs.dm"
#include "species_change_clothing.dm"
#include "species_config_sanity.dm"
#include "species_unique_id.dm"
#include "species_whitelists.dm"
@@ -0,0 +1,16 @@
///Gives a Human lizard-incompatible shoes, then changes their species over to see if they drop the now incompatible shoes.
/datum/unit_test/species_change_clothing
/datum/unit_test/species_change_clothing/Run()
// Test lizards as their own thing so we can get more coverage on their features
var/mob/living/carbon/human/human_to_lizard = allocate(/mob/living/carbon/human/dummy/consistent)
human_to_lizard.equipOutfit(/datum/outfit/job/assistant/consistent)
human_to_lizard.dna.features["legs"] = DIGITIGRADE_LEGS //you WILL have digitigrade legs
var/obj/item/human_shoes = human_to_lizard.get_item_by_slot(ITEM_SLOT_FEET)
human_shoes.supports_variations_flags = NONE //do not fit lizards at all costs.
human_to_lizard.set_species(/datum/species/lizard)
var/obj/item/lizard_shoes = human_to_lizard.get_item_by_slot(ITEM_SLOT_FEET)
TEST_ASSERT_NOTEQUAL(human_shoes, lizard_shoes, "Lizard still has shoes after changing species.")