mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
Moves "sprite accessories" (e.g. Hair, Undergarments, Mutant Bits) from GLOB to a datasystem (#82847)
This is just a revitalization of #80275. ## About The Pull Request On the tin, basically demotes everything related to setting up and storing these bulky lists generated from reading `/datum/sprite_accessory` subtypes from living in a global space that will instead be in a compartmentalized subsystem for accesses. Also a lot of code modernization and micro-improvements (unquantifiable) ## Why It's Good For The Game Same exact expected results, just accessed in a different way.  There's a few reasons why I want this to happen. * The `GLOB` space is too clogged. There are at least a thousand variables on `GLOB`, and it's extremely painful to access stuff on production/local through view variables when you're debugging stuff like this. It's also painful when there is stuff that _should_ live on `GLOB` that you might want to see in VV/Debugger but are forced to either have to scroll a mile to find what you want or wait a long while for it to load. The less bulky lists we have of stored initialized datums, the better. * `make_datum_reference_lists()` is a consequence of wack stuff like this where we're reliant on certain things being initialized in the `GLOB` portion of world initialization _before_ subsystems/static variables load - most of these datum lists in the aforementioned proc doesn't _really_ need to be ready to go before `world.New()` for example. We'll sadly have to abuse `PreInit()` for now, but it really is something that has to be ready to go due the critical dependence that stuff like Preferences has on it. * We don't have to have the procs live in a global namespace either. Instead of passing in `GLOB.XList` or `DSstorage.XList` every single time, we can instead just move the proc setup on the subsystem and use `XList` in a more native fashion. * It's easier to find what you need. To me, it's a lot nicer to ctrl+click the DS and go to the variables to find something I'm looking for instead of having to scavenge around for any footprint/trace of the global I want to look for. This is more trivial than the other two, but that's something I like to think about when I go to bed. I also had to refactor a bit of the code to accommodate the limitations of the new DS system, but it should be a lot cleaner anyways. ## Changelog Not relevant --- Also nothing should have broken but it's a good thing we have screenshot unit tests to prove me wrong.
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/socks/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.socks_list)
|
||||
return assoc_to_keys_features(SSaccessories.socks_list)
|
||||
|
||||
/datum/preference/choiced/socks/icon_for(value)
|
||||
var/static/icon/lower_half
|
||||
@@ -105,7 +105,7 @@
|
||||
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg"), ICON_OVERLAY)
|
||||
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
|
||||
|
||||
return generate_underwear_icon(GLOB.socks_list[value], lower_half)
|
||||
return generate_underwear_icon(SSaccessories.socks_list[value], lower_half)
|
||||
|
||||
/datum/preference/choiced/socks/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.socks = value
|
||||
@@ -119,7 +119,7 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/undershirt/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.undershirt_list)
|
||||
return assoc_to_keys_features(SSaccessories.undershirt_list)
|
||||
|
||||
/datum/preference/choiced/undershirt/icon_for(value)
|
||||
var/static/icon/body
|
||||
@@ -135,7 +135,7 @@
|
||||
var/icon/icon_with_undershirt = icon(body)
|
||||
|
||||
if (value != "Nude")
|
||||
var/datum/sprite_accessory/accessory = GLOB.undershirt_list[value]
|
||||
var/datum/sprite_accessory/accessory = SSaccessories.undershirt_list[value]
|
||||
icon_with_undershirt.Blend(icon('icons/mob/clothing/underwear.dmi', accessory.icon_state), ICON_OVERLAY)
|
||||
|
||||
icon_with_undershirt.Crop(9, 9, 23, 23)
|
||||
@@ -154,7 +154,7 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/underwear/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.underwear_list)
|
||||
return assoc_to_keys_features(SSaccessories.underwear_list)
|
||||
|
||||
/datum/preference/choiced/underwear/icon_for(value)
|
||||
var/static/icon/lower_half
|
||||
@@ -165,7 +165,7 @@
|
||||
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg"), ICON_OVERLAY)
|
||||
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
|
||||
|
||||
return generate_underwear_icon(GLOB.underwear_list[value], lower_half, COLOR_ALMOST_BLACK)
|
||||
return generate_underwear_icon(SSaccessories.underwear_list[value], lower_half, COLOR_ALMOST_BLACK)
|
||||
|
||||
/datum/preference/choiced/underwear/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.underwear = value
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
var/icon/final_icon = new(head_icon)
|
||||
if (!isnull(sprite_accessory))
|
||||
ASSERT(istype(sprite_accessory))
|
||||
|
||||
|
||||
var/icon/head_accessory_icon = icon(sprite_accessory.icon, sprite_accessory.icon_state)
|
||||
if(y_offset)
|
||||
head_accessory_icon.Shift(NORTH, y_offset)
|
||||
@@ -61,10 +61,10 @@
|
||||
relevant_head_flag = HEAD_FACIAL_HAIR
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.facial_hairstyles_list)
|
||||
return assoc_to_keys_features(SSaccessories.facial_hairstyles_list)
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle/icon_for(value)
|
||||
return generate_icon_with_head_accessory(GLOB.facial_hairstyles_list[value])
|
||||
return generate_icon_with_head_accessory(SSaccessories.facial_hairstyles_list[value])
|
||||
|
||||
/datum/preference/choiced/facial_hairstyle/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_facial_hairstyle(value, update = FALSE)
|
||||
@@ -94,7 +94,7 @@
|
||||
relevant_head_flag = HEAD_FACIAL_HAIR
|
||||
|
||||
/datum/preference/choiced/facial_hair_gradient/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.facial_hair_gradients_list)
|
||||
return assoc_to_keys_features(SSaccessories.facial_hair_gradients_list)
|
||||
|
||||
/datum/preference/choiced/facial_hair_gradient/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_facial_hair_gradient_style(new_style = value, update = FALSE)
|
||||
@@ -137,10 +137,10 @@
|
||||
relevant_head_flag = HEAD_HAIR
|
||||
|
||||
/datum/preference/choiced/hairstyle/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.hairstyles_list)
|
||||
return assoc_to_keys_features(SSaccessories.hairstyles_list)
|
||||
|
||||
/datum/preference/choiced/hairstyle/icon_for(value)
|
||||
var/datum/sprite_accessory/hair/hairstyle = GLOB.hairstyles_list[value]
|
||||
var/datum/sprite_accessory/hair/hairstyle = SSaccessories.hairstyles_list[value]
|
||||
return generate_icon_with_head_accessory(hairstyle, hairstyle?.y_offset)
|
||||
|
||||
/datum/preference/choiced/hairstyle/apply_to_human(mob/living/carbon/human/target, value)
|
||||
@@ -161,7 +161,7 @@
|
||||
relevant_head_flag = HEAD_HAIR
|
||||
|
||||
/datum/preference/choiced/hair_gradient/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.hair_gradients_list)
|
||||
return assoc_to_keys_features(SSaccessories.hair_gradients_list)
|
||||
|
||||
/datum/preference/choiced/hair_gradient/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.set_hair_gradient_style(new_style = value, update = FALSE)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
relevant_external_organ = /obj/item/organ/external/tail/cat
|
||||
|
||||
/datum/preference/choiced/tail_human/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.tails_list_human)
|
||||
return assoc_to_keys_features(SSaccessories.tails_list_human)
|
||||
|
||||
/datum/preference/choiced/tail_human/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.dna.features["tail_cat"] = value
|
||||
@@ -23,7 +23,7 @@
|
||||
relevant_mutant_bodypart = "ears"
|
||||
|
||||
/datum/preference/choiced/ears/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.ears_list)
|
||||
return assoc_to_keys_features(SSaccessories.ears_list)
|
||||
|
||||
/datum/preference/choiced/ears/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.dna.features["ears"] = value
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
relevant_mutant_bodypart = "body_markings"
|
||||
|
||||
/datum/preference/choiced/lizard_body_markings/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.body_markings_list)
|
||||
return assoc_to_keys_features(SSaccessories.body_markings_list)
|
||||
|
||||
/datum/preference/choiced/lizard_body_markings/icon_for(value)
|
||||
var/datum/sprite_accessory/sprite_accessory = GLOB.body_markings_list[value]
|
||||
var/datum/sprite_accessory/sprite_accessory = SSaccessories.body_markings_list[value]
|
||||
|
||||
var/icon/final_icon = icon('icons/mob/human/species/lizard/bodyparts.dmi', "lizard_chest_m")
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/lizard_frills/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.frills_list)
|
||||
return assoc_to_keys_features(SSaccessories.frills_list)
|
||||
|
||||
/datum/preference/choiced/lizard_frills/icon_for(value)
|
||||
return generate_lizard_side_shot(GLOB.frills_list[value], "frills")
|
||||
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
|
||||
@@ -81,10 +81,10 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/lizard_horns/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.horns_list)
|
||||
return assoc_to_keys_features(SSaccessories.horns_list)
|
||||
|
||||
/datum/preference/choiced/lizard_horns/icon_for(value)
|
||||
return generate_lizard_side_shot(GLOB.horns_list[value], "horns")
|
||||
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
|
||||
@@ -96,7 +96,7 @@
|
||||
relevant_mutant_bodypart = "legs"
|
||||
|
||||
/datum/preference/choiced/lizard_legs/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.legs_list)
|
||||
return assoc_to_keys_features(SSaccessories.legs_list)
|
||||
|
||||
/datum/preference/choiced/lizard_legs/apply_to_human(mob/living/carbon/human/target, value)
|
||||
target.dna.features["legs"] = value
|
||||
@@ -109,10 +109,10 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/lizard_snout/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.snouts_list)
|
||||
return assoc_to_keys_features(SSaccessories.snouts_list)
|
||||
|
||||
/datum/preference/choiced/lizard_snout/icon_for(value)
|
||||
return generate_lizard_side_shot(GLOB.snouts_list[value], "snout", include_snout = FALSE)
|
||||
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
|
||||
@@ -124,7 +124,7 @@
|
||||
relevant_mutant_bodypart = "spines"
|
||||
|
||||
/datum/preference/choiced/lizard_spines/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.spines_list)
|
||||
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
|
||||
@@ -136,7 +136,7 @@
|
||||
relevant_external_organ = /obj/item/organ/external/tail/lizard
|
||||
|
||||
/datum/preference/choiced/lizard_tail/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.tails_list_lizard)
|
||||
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
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
relevant_external_organ = /obj/item/organ/external/tail/monkey
|
||||
|
||||
/datum/preference/choiced/monkey_tail/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.tails_list_monkey)
|
||||
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
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/moth_antennae/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.moth_antennae_list)
|
||||
return assoc_to_keys_features(SSaccessories.moth_antennae_list)
|
||||
|
||||
/datum/preference/choiced/moth_antennae/icon_for(value)
|
||||
var/static/icon/moth_head
|
||||
@@ -16,7 +16,7 @@
|
||||
moth_head.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_l"), ICON_OVERLAY)
|
||||
moth_head.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_r"), ICON_OVERLAY)
|
||||
|
||||
var/datum/sprite_accessory/antennae = GLOB.moth_antennae_list[value]
|
||||
var/datum/sprite_accessory/antennae = SSaccessories.moth_antennae_list[value]
|
||||
|
||||
var/icon/icon_with_antennae = new(moth_head)
|
||||
icon_with_antennae.Blend(icon(antennae.icon, "m_moth_antennae_[antennae.icon_state]_FRONT"), ICON_OVERLAY)
|
||||
@@ -37,7 +37,7 @@
|
||||
relevant_mutant_bodypart = "moth_markings"
|
||||
|
||||
/datum/preference/choiced/moth_markings/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.moth_markings_list)
|
||||
return assoc_to_keys_features(SSaccessories.moth_markings_list)
|
||||
|
||||
/datum/preference/choiced/moth_markings/icon_for(value)
|
||||
var/static/list/body_parts = list(
|
||||
@@ -59,7 +59,7 @@
|
||||
moth_body.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_l"), ICON_OVERLAY)
|
||||
moth_body.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_r"), ICON_OVERLAY)
|
||||
|
||||
var/datum/sprite_accessory/markings = GLOB.moth_markings_list[value]
|
||||
var/datum/sprite_accessory/markings = SSaccessories.moth_markings_list[value]
|
||||
var/icon/icon_with_markings = new(moth_body)
|
||||
|
||||
if (value != "None")
|
||||
@@ -88,10 +88,10 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/moth_wings/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.moth_wings_list)
|
||||
return assoc_to_keys_features(SSaccessories.moth_wings_list)
|
||||
|
||||
/datum/preference/choiced/moth_wings/icon_for(value)
|
||||
var/datum/sprite_accessory/moth_wings = GLOB.moth_wings_list[value]
|
||||
var/datum/sprite_accessory/moth_wings = SSaccessories.moth_wings_list[value]
|
||||
var/icon/final_icon = icon(moth_wings.icon, "m_moth_wings_[moth_wings.icon_state]_BEHIND")
|
||||
final_icon.Blend(icon(moth_wings.icon, "m_moth_wings_[moth_wings.icon_state]_FRONT"), ICON_OVERLAY)
|
||||
return final_icon
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
relevant_mutant_bodypart = "cap"
|
||||
|
||||
/datum/preference/choiced/mushroom_cap/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.caps_list)
|
||||
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
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
should_generate_icons = TRUE
|
||||
|
||||
/datum/preference/choiced/pod_hair/init_possible_values()
|
||||
return assoc_to_keys_features(GLOB.pod_hair_list)
|
||||
return assoc_to_keys_features(SSaccessories.pod_hair_list)
|
||||
|
||||
/datum/preference/choiced/pod_hair/icon_for(value)
|
||||
var/datum/sprite_accessory/pod_hair = GLOB.pod_hair_list[value]
|
||||
var/datum/sprite_accessory/pod_hair = SSaccessories.pod_hair_list[value]
|
||||
|
||||
var/icon/icon_with_hair = icon('icons/mob/human/bodyparts_greyscale.dmi', "pod_head_m")
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
return icon_with_hair
|
||||
|
||||
/datum/preference/choiced/pod_hair/create_default_value()
|
||||
return pick(assoc_to_keys_features(GLOB.pod_hair_list))
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user