mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
Datumizes DNA blocks, makes DNA cleaner in general (#92061)
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. /🆑
This commit is contained in:
@@ -199,15 +199,15 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror/broken, 28)
|
||||
var/new_s_tone = tgui_input_list(race_changer, "Choose your skin tone", "Race change", GLOB.skin_tones)
|
||||
if(new_s_tone)
|
||||
race_changer.skin_tone = new_s_tone
|
||||
race_changer.dna.update_ui_block(DNA_SKIN_TONE_BLOCK)
|
||||
race_changer.dna.update_ui_block(/datum/dna_block/identity/skin_tone)
|
||||
else if(HAS_TRAIT(race_changer, TRAIT_MUTANT_COLORS) && !HAS_TRAIT(race_changer, TRAIT_FIXED_MUTANT_COLORS))
|
||||
var/new_mutantcolor = tgui_color_picker(race_changer, "Choose your skin color:", "Race change", race_changer.dna.features["mcolor"]) // BUBBERSTATION EDIT: TGUI COLOR PICKER
|
||||
var/new_mutantcolor = tgui_color_picker(race_changer, "Choose your skin color:", "Race change", race_changer.dna.features[FEATURE_MUTANT_COLOR]) // BUBBERSTATION EDIT: TGUI COLOR PICKER
|
||||
if(new_mutantcolor)
|
||||
var/list/mutant_hsv = rgb2hsv(new_mutantcolor)
|
||||
|
||||
if(mutant_hsv[3] >= 50) // mutantcolors must be bright
|
||||
race_changer.dna.features["mcolor"] = sanitize_hexcolor(new_mutantcolor)
|
||||
race_changer.dna.update_uf_block(DNA_MUTANT_COLOR_BLOCK)
|
||||
race_changer.dna.features[FEATURE_MUTANT_COLOR] = sanitize_hexcolor(new_mutantcolor)
|
||||
race_changer.dna.update_uf_block(FEATURE_MUTANT_COLOR)
|
||||
else
|
||||
to_chat(race_changer, span_notice("Invalid color. Your color is not bright enough."))
|
||||
return TRUE
|
||||
@@ -241,7 +241,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror/broken, 28)
|
||||
if(chosen_physique && chosen_physique != "Wizards Don't Need Gender")
|
||||
sexy.physique = (chosen_physique == "Warlock Physique") ? MALE : FEMALE
|
||||
|
||||
sexy.dna.update_ui_block(DNA_GENDER_BLOCK)
|
||||
sexy.dna.update_ui_block(/datum/dna_block/identity/gender)
|
||||
sexy.update_body(is_creating = TRUE) // or else physique won't change properly
|
||||
sexy.update_mutations_overlay() //(hulk male/female)
|
||||
sexy.update_clothing(ITEM_SLOT_ICLOTHING) // update gender shaped clothing
|
||||
@@ -251,8 +251,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror/broken, 28)
|
||||
if(isnull(new_eye_color))
|
||||
return TRUE
|
||||
user.set_eye_color(sanitize_hexcolor(new_eye_color))
|
||||
user.dna.update_ui_block(DNA_EYE_COLOR_LEFT_BLOCK)
|
||||
user.dna.update_ui_block(DNA_EYE_COLOR_RIGHT_BLOCK)
|
||||
user.dna.update_ui_block(/datum/dna_block/identity/eye_colors)
|
||||
user.update_body()
|
||||
to_chat(user, span_notice("You gaze at your new eyes with your new eyes. Perfect!"))
|
||||
|
||||
@@ -383,12 +382,12 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror/broken, 28)
|
||||
|
||||
if(new_hair_color)
|
||||
user.set_haircolor(sanitize_hexcolor(new_hair_color))
|
||||
user.dna.update_ui_block(DNA_HAIR_COLOR_BLOCK)
|
||||
user.dna.update_ui_block(/datum/dna_block/identity/hair_color)
|
||||
if(user.physique == MALE)
|
||||
var/new_face_color = tgui_color_picker(user, "Choose your facial hair color", "Hair Color", user.facial_hair_color) // BUBBERSTATION EDIT: TGUI COLOR PICKER
|
||||
if(new_face_color)
|
||||
user.set_facial_haircolor(sanitize_hexcolor(new_face_color))
|
||||
user.dna.update_ui_block(DNA_FACIAL_HAIR_COLOR_BLOCK)
|
||||
user.dna.update_ui_block(/datum/dna_block/identity/facial_color)
|
||||
|
||||
/obj/structure/mirror/magic/attack_hand(mob/living/carbon/human/user)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user