Files
Bubberstation/code/modules/unit_tests/screenshot_humanoids.dm
Waterpig b01756b97c Datumizes DNA blocks, makes DNA cleaner in general (#92061)
## About The Pull Request

Moves all the dna block handling onto singleton datums initialized
inside global lists, to make the handling dna less of a copy-paste mess
and make adding new blocks significantly easier. There is still some
work to be done in the copypaste department but ultimately that falls
under its own PR scope after the core refactor goes through. (Ill
probably do those but it will also be easier for everyone else as the
code is now significantly less of an eyesore)

Both features and identities have been tested through and through, and
seem to be working fine.

Also removed the reliance on weird hardcoded lookup tables for length,
and other similar things that just didn't make sense when I was passing
through DNA code. There's a lot more that fall out of scope for this
exact PR's goal however

## Why It's Good For The Game

I've been told the maintainers will love me for doing this

## Changelog

🆑
code: feature keys are no longer magical strings floating around the
codebase and use proper defines
refactor: DNA blocks are now handled with singleton datums.
/🆑
2025-07-14 16:51:45 -06:00

55 lines
2.7 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[FEATURE_MUTANT_COLOR] = "#099"
lizard.dna.features[FEATURE_TAIL_LIZARD] = "Light Tiger"
lizard.dna.features[FEATURE_SNOUT] = "Sharp + Light"
lizard.dna.features[FEATURE_HORNS] = "Simple"
lizard.dna.features[FEATURE_FRILLS] = "Aquatic"
lizard.dna.features[FEATURE_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
// Test humans as naked so we can catch issues with bodypart layering
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/dummy/consistent)
test_screenshot("[/datum/species/human]", get_flat_icon_for_all_directions(human))
testable_species -= /datum/species/human
// let me have this
var/mob/living/carbon/human/moth = allocate(/mob/living/carbon/human/dummy/consistent)
moth.dna.features[FEATURE_MOTH_ANTENNAE] = "Firewatch"
moth.dna.features[FEATURE_MOTH_MARKINGS] = "None"
moth.dna.features[FEATURE_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[FEATURE_MUTANT_COLOR] = 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