mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
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 I've been told the maintainers will love me for doing this 🆑 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. /🆑
31 lines
1009 B
Plaintext
31 lines
1009 B
Plaintext
/* SKYRAT EDIT REMOVAL
|
|
/datum/preference/color/mutant_color
|
|
savefile_key = "feature_mcolor"
|
|
savefile_identifier = PREFERENCE_CHARACTER
|
|
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
|
relevant_inherent_trait = TRAIT_MUTANT_COLORS
|
|
|
|
/datum/preference/color/mutant_color/is_accessible(datum/preferences/preferences)
|
|
if (!..(preferences))
|
|
return FALSE
|
|
|
|
var/species_type = preferences.read_preference(/datum/preference/choiced/species)
|
|
var/datum/species/species = GLOB.species_prototypes[species_type]
|
|
return !(TRAIT_FIXED_MUTANT_COLORS in species.inherent_traits)
|
|
|
|
/datum/preference/color/mutant_color/create_default_value()
|
|
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[FEATURE_MUTANT_COLOR] = value
|
|
|
|
/datum/preference/color/mutant_color/is_valid(value)
|
|
if (!..(value))
|
|
return FALSE
|
|
|
|
if (is_color_dark(value, 15))
|
|
return FALSE
|
|
|
|
return TRUE
|
|
*/
|