mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-30 02:52:30 +00:00
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.
61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
/obj/structure/dresser
|
|
name = "dresser"
|
|
desc = "A nicely-crafted wooden dresser. It's filled with lots of undies."
|
|
icon = 'icons/obj/fluff/general.dmi'
|
|
icon_state = "dresser"
|
|
resistance_flags = FLAMMABLE
|
|
density = TRUE
|
|
anchored = TRUE
|
|
|
|
/obj/structure/dresser/attackby(obj/item/I, mob/user, params)
|
|
if(I.tool_behaviour == TOOL_WRENCH)
|
|
to_chat(user, span_notice("You begin to [anchored ? "unwrench" : "wrench"] [src]."))
|
|
if(I.use_tool(src, user, 20, volume=50))
|
|
to_chat(user, span_notice("You successfully [anchored ? "unwrench" : "wrench"] [src]."))
|
|
set_anchored(!anchored)
|
|
else
|
|
return ..()
|
|
|
|
/obj/structure/dresser/atom_deconstruct(disassembled = TRUE)
|
|
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
|
|
|
|
/obj/structure/dresser/attack_hand(mob/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
if(!Adjacent(user))//no tele-grooming
|
|
return
|
|
if(!ishuman(user))
|
|
return
|
|
var/mob/living/carbon/human/dressing_human = user
|
|
if(HAS_TRAIT(dressing_human, TRAIT_NO_UNDERWEAR))
|
|
to_chat(dressing_human, span_warning("You are not capable of wearing underwear."))
|
|
return
|
|
|
|
var/choice = tgui_input_list(user, "Underwear, Undershirt, or Socks?", "Changing", list("Underwear","Underwear Color","Undershirt","Socks"))
|
|
if(isnull(choice))
|
|
return
|
|
|
|
if(!Adjacent(user))
|
|
return
|
|
switch(choice)
|
|
if("Underwear")
|
|
var/new_undies = tgui_input_list(user, "Select your underwear", "Changing", SSaccessories.underwear_list)
|
|
if(new_undies)
|
|
dressing_human.underwear = new_undies
|
|
if("Underwear Color")
|
|
var/new_underwear_color = input(dressing_human, "Choose your underwear color", "Underwear Color", dressing_human.underwear_color) as color|null
|
|
if(new_underwear_color)
|
|
dressing_human.underwear_color = sanitize_hexcolor(new_underwear_color)
|
|
if("Undershirt")
|
|
var/new_undershirt = tgui_input_list(user, "Select your undershirt", "Changing", SSaccessories.undershirt_list)
|
|
if(new_undershirt)
|
|
dressing_human.undershirt = new_undershirt
|
|
if("Socks")
|
|
var/new_socks = tgui_input_list(user, "Select your socks", "Changing", SSaccessories.socks_list)
|
|
if(new_socks)
|
|
dressing_human.socks = new_socks
|
|
|
|
add_fingerprint(dressing_human)
|
|
dressing_human.update_body()
|