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.
/🆑
This commit is contained in:
Waterpig
2025-07-14 16:51:45 -06:00
committed by GitHub
parent c4ee3d604f
commit b01756b97c
52 changed files with 622 additions and 492 deletions
@@ -33,4 +33,4 @@
return icon
/datum/preference/choiced/ethereal_color/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["ethcolor"] = GLOB.color_list_ethereal[value]
target.dna.features[FEATURE_ETHEREAL_COLOR] = GLOB.color_list_ethereal[value]
@@ -9,7 +9,7 @@
return assoc_to_keys_features(SSaccessories.tails_list_felinid)
/datum/preference/choiced/tail_felinid/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["tail_cat"] = value
target.dna.features[FEATURE_TAIL] = value
/datum/preference/choiced/tail_felinid/create_default_value()
var/datum/sprite_accessory/tails/felinid/cat/tail = /datum/sprite_accessory/tails/felinid/cat
@@ -26,7 +26,7 @@
return assoc_to_keys_features(SSaccessories.ears_list)
/datum/preference/choiced/felinid_ears/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["ears"] = value
target.dna.features[FEATURE_EARS] = value
/datum/preference/choiced/felinid_ears/create_default_value()
return /datum/sprite_accessory/ears/cat::name
@@ -55,7 +55,7 @@
return final_icon
/datum/preference/choiced/lizard_body_markings/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["lizard_markings"] = value
target.dna.features[FEATURE_LIZARD_MARKINGS] = value
/datum/preference/choiced/lizard_frills
savefile_key = "feature_lizard_frills"
@@ -72,7 +72,7 @@
return generate_lizard_side_shot(SSaccessories.frills_list[value], "frills")
/datum/preference/choiced/lizard_frills/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["frills"] = value
target.dna.features[FEATURE_FRILLS] = value
/datum/preference/choiced/lizard_horns
savefile_key = "feature_lizard_horns"
@@ -89,7 +89,7 @@
return generate_lizard_side_shot(SSaccessories.horns_list[value], "horns")
/datum/preference/choiced/lizard_horns/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["horns"] = value
target.dna.features[FEATURE_HORNS] = value
/datum/preference/choiced/lizard_legs
savefile_key = "feature_lizard_legs"
@@ -100,7 +100,7 @@
return list(NORMAL_LEGS, DIGITIGRADE_LEGS)
/datum/preference/choiced/lizard_legs/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["legs"] = value
target.dna.features[FEATURE_LEGS] = value
// Hack to update the dummy in the preference menu
// (Because digi legs are ONLY handled on species change)
if(!isdummy(target) || target.dna.species.digitigrade_customization == DIGITIGRADE_NEVER)
@@ -145,7 +145,7 @@
return generate_lizard_side_shot(SSaccessories.snouts_list[value], "snout", include_snout = FALSE)
/datum/preference/choiced/lizard_snout/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["snout"] = value
target.dna.features[FEATURE_SNOUT] = value
/datum/preference/choiced/lizard_spines
savefile_key = "feature_lizard_spines"
@@ -157,7 +157,7 @@
return assoc_to_keys_features(SSaccessories.spines_list)
/datum/preference/choiced/lizard_spines/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["spines"] = value
target.dna.features[FEATURE_SPINES] = value
/datum/preference/choiced/lizard_tail
savefile_key = "feature_lizard_tail"
@@ -169,7 +169,7 @@
return assoc_to_keys_features(SSaccessories.tails_list_lizard)
/datum/preference/choiced/lizard_tail/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["tail_lizard"] = value
target.dna.features[FEATURE_TAIL_LIZARD] = value
/datum/preference/choiced/lizard_tail/create_default_value()
return /datum/sprite_accessory/tails/lizard/smooth::name
@@ -9,7 +9,7 @@
return assoc_to_keys_features(SSaccessories.tails_list_monkey)
/datum/preference/choiced/monkey_tail/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["tail_monkey"] = value
target.dna.features[FEATURE_TAIL_MONKEY] = value
/datum/preference/choiced/monkey_tail/create_default_value()
return /datum/sprite_accessory/tails/monkey/default::name
@@ -27,7 +27,7 @@
return icon_with_antennae
/datum/preference/choiced/moth_antennae/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["moth_antennae"] = value
target.dna.features[FEATURE_MOTH_ANTENNAE] = value
/datum/preference/choiced/moth_markings
savefile_key = "feature_moth_markings"
@@ -77,7 +77,7 @@
return icon_with_markings
/datum/preference/choiced/moth_markings/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["moth_markings"] = value
target.dna.features[FEATURE_MOTH_MARKINGS] = value
/datum/preference/choiced/moth_wings
savefile_key = "feature_moth_wings"
@@ -95,4 +95,4 @@
return uni_icon(moth_wings.icon, "m_moth_wings_[moth_wings.icon_state]_BEHIND")
/datum/preference/choiced/moth_wings/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["moth_wings"] = value
target.dna.features[FEATURE_MOTH_WINGS] = value
@@ -8,4 +8,4 @@
return assoc_to_keys_features(SSaccessories.caps_list)
/datum/preference/choiced/mushroom_cap/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["caps"] = value
target.dna.features[FEATURE_MUSH_CAP] = value
@@ -16,7 +16,7 @@
return sanitize_hexcolor("[pick("7F", "FF")][pick("7F", "FF")][pick("7F", "FF")]")
/datum/preference/color/mutant_color/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["mcolor"] = value
target.dna.features[FEATURE_MUTANT_COLOR] = value
/datum/preference/color/mutant_color/is_valid(value)
if (!..(value))
@@ -28,4 +28,4 @@
return pick(assoc_to_keys_features(SSaccessories.pod_hair_list))
/datum/preference/choiced/pod_hair/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["pod_hair"] = value
target.dna.features[FEATURE_POD_HAIR] = value