Files
Bubberstation/code/modules/unit_tests/screenshot_humanoids.dm
T
ProfakosandGitHub 9f7d6dea62 Outfits that put items in your hand now respect if the outfit is visual only (#87355)
## About The Pull Request

On a downstream, we have an antagonist, that is a less competent
wizards. This antagonist's preview outfit has a beer bottle in their
hand, which has caused runtimes, as the bottle did not have any reagents
instantiated, and it tried check its length for sloshing. After putting
in a check for the `initial` argument of `on_equip`, I have noticed that
the problem goes deeper: the various procs that handle putting something
in your hand do not pass along if the items is put in your hand as a
preview or not. This PR adds a new optional var to these procs, ensuring
that unwanted behaviour during previews won't trigger.

I also swapped `visualsOnly` to snake case, as it looked inconsistent
with the rest of the code style.
 
## Why It's Good For The Game

Making the argument that ensures avoiding side effects during previews
work with all kinds of items is good.

## Changelog

🆑
fix: if an outfit puts a reagent container in the preview dummy's hand,
it will not try to slosh
code: outfits putting items in your hand will respect the visual_only
argument
/🆑
2024-10-24 15:09:50 +02:00

50 lines
2.4 KiB
Plaintext

/// A screenshot test for every humanoid species with a handful of jobs.
/datum/unit_test/screenshot_humanoids
/datum/unit_test/screenshot_humanoids/Run()
var/list/testable_species = subtypesof(/datum/species)
// Test lizards as their own thing so we can get more coverage on their features
var/mob/living/carbon/human/lizard = allocate(/mob/living/carbon/human/dummy/consistent)
lizard.dna.features["mcolor"] = "#099"
lizard.dna.features["tail_lizard"] = "Light Tiger"
lizard.dna.features["snout"] = "Sharp + Light"
lizard.dna.features["horns"] = "Simple"
lizard.dna.features["frills"] = "Aquatic"
lizard.dna.features["legs"] = "Normal Legs"
lizard.set_species(/datum/species/lizard)
lizard.equipOutfit(/datum/outfit/job/engineer)
test_screenshot("[/datum/species/lizard]", get_flat_icon_for_all_directions(lizard))
testable_species -= /datum/species/lizard
// let me have this
var/mob/living/carbon/human/moth = allocate(/mob/living/carbon/human/dummy/consistent)
moth.dna.features["moth_antennae"] = "Firewatch"
moth.dna.features["moth_markings"] = "None"
moth.dna.features["moth_wings"] = "Firewatch"
moth.set_species(/datum/species/moth)
moth.equipOutfit(/datum/outfit/job/cmo, visuals_only = TRUE)
test_screenshot("[/datum/species/moth]", get_flat_icon_for_all_directions(moth))
testable_species -= /datum/species/moth
// More in depth test for slimes since they have a lot going on
for (var/datum/species/slime_type as anything in typesof(/datum/species/jelly))
var/mob/living/carbon/human/slime = allocate(/mob/living/carbon/human/dummy/consistent)
slime.dna.features["mcolor"] = COLOR_PINK
slime.hairstyle = "Bob Hair 2"
slime.hair_color = COLOR_RED // Should be forced to pink
slime.set_species(slime_type)
slime.equipOutfit(/datum/outfit/job/scientist/consistent)
test_screenshot("[slime_type]", get_flat_icon_for_all_directions(slime))
testable_species -= slime_type
// The rest of the species
for (var/datum/species/species_type as anything in testable_species)
test_screenshot("[species_type]", get_flat_icon_for_all_directions(make_dummy(species_type, /datum/outfit/job/assistant/consistent)))
/datum/unit_test/screenshot_humanoids/proc/make_dummy(species, job_outfit)
var/mob/living/carbon/human/dummy/consistent/dummy = allocate(/mob/living/carbon/human/dummy/consistent)
dummy.set_species(species)
dummy.equipOutfit(job_outfit, visuals_only = TRUE)
return dummy