Turn more unmanaged global vars into GLOB (#20446)

Turned a ton of unmanaged globals into managed globals.
Refactored some UT output.
Removed some unused things, including vars.
Added a test to ensure people don't keep adding new unmanaged vars.
This commit is contained in:
Fluffy
2025-02-17 23:34:02 +00:00
committed by GitHub
parent eff1fb22de
commit 7265630dde
377 changed files with 1893 additions and 2288 deletions
@@ -101,7 +101,7 @@ Alpha adjustment
Accent colour
*/
var/datum/gear_tweak/color/accent/gear_tweak_accent_color = new()
GLOBAL_DATUM_INIT(gear_tweak_accent_color, /datum/gear_tweak/color/accent, new())
/datum/gear_tweak/color/accent/get_contents(var/metadata)
return "Accent Color: <font color='[metadata]'>&#9899;</font>"
@@ -115,7 +115,8 @@ var/datum/gear_tweak/color/accent/gear_tweak_accent_color = new()
/*
Color Rotation adjustment
*/
var/datum/gear_tweak/color_rotation/gear_tweak_color_rotation = new()
GLOBAL_DATUM_INIT(gear_tweak_color_rotation, /datum/gear_tweak/color_rotation, new())
/datum/gear_tweak/color_rotation/get_contents(var/metadata)
return "Color Rotation: [metadata]"
@@ -250,7 +251,7 @@ Reagents adjustment
Custom Name
*/
var/datum/gear_tweak/custom_name/gear_tweak_free_name = new()
GLOBAL_DATUM_INIT(gear_tweak_free_name, /datum/gear_tweak/custom_name, new())
/datum/gear_tweak/custom_name
var/list/valid_custom_names
@@ -287,7 +288,8 @@ var/datum/gear_tweak/custom_name/gear_tweak_free_name = new()
/*
Custom Description
*/
var/datum/gear_tweak/custom_desc/gear_tweak_free_desc = new()
GLOBAL_DATUM_INIT(gear_tweak_free_desc, /datum/gear_tweak/custom_desc, new())
/datum/gear_tweak/custom_desc
var/list/valid_custom_desc
@@ -378,7 +380,8 @@ Paper Data
// Accessory Slot Settings
var/datum/gear_tweak/accessory_slot/gear_tweak_accessory_slot = new()
GLOBAL_DATUM_INIT(gear_tweak_accessory_slot, /datum/gear_tweak/accessory_slot, new())
/datum/gear_tweak/accessory_slot
var/static/list/accessory_slots = list(GEAR_TWEAK_ACCESSORY_SLOT_UNDER, GEAR_TWEAK_ACCESSORY_SLOT_SUIT, GEAR_TWEAK_ACCESSORY_SLOT_SUIT_STANDALONE)
@@ -35,7 +35,7 @@
lipsticks["lipstick, teal"] = /obj/item/lipstick/teal
gear_tweaks += new /datum/gear_tweak/path(lipsticks)
gear_tweaks += list(gear_tweak_lipstick_application)
gear_tweaks += list(GLOB.gear_tweak_lipstick_application)
/datum/gear/cosmetic/lipstick_colorable // not a subtype because we dont want the path gear_tweaks
display_name = "colorable lipstick"
@@ -44,10 +44,10 @@
/datum/gear/cosmetic/lipstick_colorable/New()
..()
gear_tweaks += list(gear_tweak_lipstick_color)
gear_tweaks += list(gear_tweak_lipstick_application)
gear_tweaks += list(GLOB.gear_tweak_lipstick_color)
gear_tweaks += list(GLOB.gear_tweak_lipstick_application)
var/datum/gear_tweak/color/lipstick/gear_tweak_lipstick_color = new()
GLOBAL_DATUM_INIT(gear_tweak_lipstick_color, /datum/gear_tweak/color/lipstick, new())
/datum/gear_tweak/color/lipstick/get_contents(var/metadata)
return "Lipstick Color: <font color='[metadata]'>&#9899;</font>"
@@ -57,7 +57,7 @@ var/datum/gear_tweak/color/lipstick/gear_tweak_lipstick_color = new()
lipstick.update_icon()
var/datum/gear_tweak/lipstick_application/gear_tweak_lipstick_application = new()
GLOBAL_DATUM_INIT(gear_tweak_lipstick_application, /datum/gear_tweak/lipstick_application, new())
/datum/gear_tweak/lipstick_application/get_contents(var/metadata)
return "Lipstick Applied: [metadata]"
@@ -370,10 +370,10 @@
/datum/gear/faction/pmc_modsuit/New()
..()
gear_tweaks += list(gear_tweak_modsuit_configuration)
gear_tweaks += list(GLOB.gear_tweak_modsuit_configuration)
var/datum/gear_tweak/modsuit_configuration/gear_tweak_modsuit_configuration = new()
GLOBAL_DATUM_INIT(gear_tweak_modsuit_configuration, /datum/gear_tweak/modsuit_configuration, new())
/datum/gear_tweak/modsuit_configuration
/// the configuration of the modsuit, using just a list of the names
@@ -443,7 +443,7 @@ var/datum/gear_tweak/modsuit_configuration/gear_tweak_modsuit_configuration = ne
pmcg_sec_uniforms["Grupo Amapola uniform"] = /obj/item/clothing/under/rank/security/pmc/grupo_amapola
pmcg_sec_uniforms["Nexus Corporate uniform"] = /obj/item/clothing/under/rank/security/pmc/nexus
gear_tweaks += new /datum/gear_tweak/path(pmcg_sec_uniforms)
gear_tweaks += list(gear_tweak_uniform_rolled_state)
gear_tweaks += list(GLOB.gear_tweak_uniform_rolled_state)
/datum/gear/faction/erisec_patch
display_name = "EPMC sleeve patch"
@@ -6,7 +6,7 @@
/datum/gear/head/New()
..()
gear_tweaks += list(gear_tweak_hair_block)
gear_tweaks += list(GLOB.gear_tweak_hair_block)
/datum/gear/head/boonie_blue
display_name = "blue boonie hat"
@@ -532,7 +532,8 @@
/*
Block Hair Adjustment
*/
var/datum/gear_tweak/hair_block/gear_tweak_hair_block = new()
GLOBAL_DATUM_INIT(gear_tweak_hair_block, /datum/gear_tweak/hair_block, new())
/datum/gear_tweak/hair_block/get_contents(var/metadata)
return "Blocks Hair: [metadata]"
@@ -7,7 +7,7 @@
/datum/gear/shoes/New()
..()
gear_tweaks += list(gear_tweak_shoe_layer)
gear_tweaks += list(GLOB.gear_tweak_shoe_layer)
/datum/gear/shoes/color
display_name = "sneakers selection"
@@ -193,7 +193,8 @@
/*
Shoe Layer Adjustment
*/
var/datum/gear_tweak/shoe_layer/gear_tweak_shoe_layer = new()
GLOBAL_DATUM_INIT(gear_tweak_shoe_layer, /datum/gear_tweak/shoe_layer, new())
/datum/gear_tweak/shoe_layer/get_contents(var/metadata)
return "Shoe Layer: [metadata] Uniform"
@@ -7,7 +7,7 @@
/datum/gear/uniform/New()
..()
gear_tweaks += list(gear_tweak_uniform_rolled_state)
gear_tweaks += list(GLOB.gear_tweak_uniform_rolled_state)
/datum/gear/uniform/iacjumpsuit
display_name = "IAC Jumpsuit"
@@ -362,7 +362,7 @@
#define UNIFORM_ROLLED_SLEEVES "Rolled Sleeves"
#define UNIFORM_ROLLED_DOWN "Rolled Down"
var/datum/gear_tweak/uniform_rolled_state/gear_tweak_uniform_rolled_state = new()
GLOBAL_DATUM_INIT(gear_tweak_uniform_rolled_state, /datum/gear_tweak/uniform_rolled_state, new())
/datum/gear_tweak/uniform_rolled_state/get_contents(var/metadata)
return "Rolled State: [metadata]"
@@ -269,7 +269,7 @@ ABSTRACT_TYPE(/datum/gear/accessory/diona)
/datum/gear/accessory/diona/skrell_passport/New()
. = ..()
gear_tweaks += list(compat_index_tweak)
gear_tweaks += list(GLOB.compat_index_tweak)
/datum/gear/accessory/diona/skrell_passport/check_species_whitelist(mob/living/carbon/human/H)
var/static/list/species_list = list(SPECIES_DIONA, SPECIES_DIONA_COEUS)
@@ -213,7 +213,7 @@ ABSTRACT_TYPE(/datum/gear/ears/skrell)
/datum/gear/accessory/skrell_passport/New()
. = ..()
gear_tweaks += list(compat_index_tweak)
gear_tweaks += list(GLOB.compat_index_tweak)
// the whitelisted list ensures only people with skrell, vaurca, or diona whitelists can reach this check
/datum/gear/accessory/skrell_passport/check_species_whitelist(mob/living/carbon/human/H)
@@ -247,7 +247,8 @@ ABSTRACT_TYPE(/datum/gear/ears/skrell)
/*
Skrellian Social Compatibility Index
*/
var/datum/gear_tweak/compat_index/compat_index_tweak = new()
GLOBAL_DATUM_INIT(compat_index_tweak, /datum/gear_tweak/compat_index, new())
/datum/gear_tweak/compat_index/get_contents(var/metadata)
return "Social Compatibility Index: [metadata]"
@@ -1,5 +1,5 @@
var/list/loadout_categories = list()
var/list/gear_datums = list()
GLOBAL_LIST_INIT(loadout_categories, list())
GLOBAL_LIST_INIT(gear_datums, list())
/datum/loadout_category
var/category = ""
@@ -22,15 +22,15 @@ var/list/gear_datums = list()
var/use_name = initial(G.display_name)
var/use_category = initial(G.sort_category)
if(!loadout_categories[use_category])
loadout_categories[use_category] = new /datum/loadout_category(use_category)
var/datum/loadout_category/LC = loadout_categories[use_category]
gear_datums[use_name] = new geartype
LC.gear[use_name] = gear_datums[use_name]
if(!GLOB.loadout_categories[use_category])
GLOB.loadout_categories[use_category] = new /datum/loadout_category(use_category)
var/datum/loadout_category/LC = GLOB.loadout_categories[use_category]
GLOB.gear_datums[use_name] = new geartype
LC.gear[use_name] = GLOB.gear_datums[use_name]
sortTim(loadout_categories, GLOBAL_PROC_REF(cmp_text_asc), FALSE)
for(var/loadout_category in loadout_categories)
var/datum/loadout_category/LC = loadout_categories[loadout_category]
sortTim(GLOB.loadout_categories, GLOBAL_PROC_REF(cmp_text_asc), FALSE)
for(var/loadout_category in GLOB.loadout_categories)
var/datum/loadout_category/LC = GLOB.loadout_categories[loadout_category]
sortTim(LC.gear, GLOBAL_PROC_REF(cmp_text_asc), FALSE)
return TRUE
@@ -109,8 +109,8 @@ var/list/gear_datums = list()
if(is_alien_whitelisted(preference_mob, S))
whitelist_cache += S.name
for(var/gear_name in gear_datums)
var/datum/gear/G = gear_datums[gear_name]
for(var/gear_name in GLOB.gear_datums)
var/datum/gear/G = GLOB.gear_datums[gear_name]
if(max_cost && G.cost > max_cost)
continue
else if(G.whitelisted && whitelist_cache.len)
@@ -153,19 +153,19 @@ var/list/gear_datums = list()
pref.gear_slot = 1
for(var/gear_name in pref.gear)
if(!(gear_name in gear_datums))
if(!(gear_name in GLOB.gear_datums))
pref.gear -= gear_name
var/total_cost = 0
var/list/player_valid_gear_choices = valid_gear_choices()
for(var/gear_name in pref.gear)
if(!gear_datums[gear_name])
if(!GLOB.gear_datums[gear_name])
to_chat(preference_mob, SPAN_WARNING("You cannot have more than one of the \the [gear_name]"))
pref.gear -= gear_name
else if(!(gear_name in player_valid_gear_choices))
to_chat(preference_mob, SPAN_WARNING("You cannot take \the [gear_name] as you are not whitelisted for the species."))
pref.gear -= gear_name
else
var/datum/gear/G = gear_datums[gear_name]
var/datum/gear/G = GLOB.gear_datums[gear_name]
if(total_cost + G.cost > GLOB.config.loadout_cost)
pref.gear -= gear_name
to_chat(preference_mob, SPAN_WARNING("You cannot afford to take \the [gear_name]"))
@@ -176,7 +176,7 @@ var/list/gear_datums = list()
var/total_cost = 0
if(pref.gear && pref.gear.len)
for(var/i = 1; i <= pref.gear.len; i++)
var/datum/gear/G = gear_datums[pref.gear[i]]
var/datum/gear/G = GLOB.gear_datums[pref.gear[i]]
if(G)
total_cost += G.cost
@@ -191,7 +191,7 @@ var/list/gear_datums = list()
. += "<tr><td colspan=3><center><b>"
var/firstcat = 1
for(var/category in loadout_categories)
for(var/category in GLOB.loadout_categories)
if(firstcat)
firstcat = 0
@@ -200,7 +200,7 @@ var/list/gear_datums = list()
if(category == current_tab)
. += " [category] "
else
var/datum/loadout_category/LC = loadout_categories[category]
var/datum/loadout_category/LC = GLOB.loadout_categories[category]
var/style = ""
for(var/thing in LC.gear)
if(thing in pref.gear)
@@ -209,7 +209,7 @@ var/list/gear_datums = list()
. += " <a href='?src=[REF(src)];select_category=[category]'><font [style]>[category]</font></a> "
. += "</b></center></td></tr>"
var/datum/loadout_category/LC = loadout_categories[current_tab]
var/datum/loadout_category/LC = GLOB.loadout_categories[current_tab]
. += "<tr><td colspan=3><hr></td></tr>"
. += "<tr><td colspan=3>"
@@ -356,20 +356,20 @@ var/list/gear_datums = list()
/datum/category_item/player_setup_item/loadout/OnTopic(href, href_list, user)
if(href_list["toggle_gear"])
pref.gear_modified = TRUE
var/datum/gear/TG = gear_datums[href_list["toggle_gear"]]
var/datum/gear/TG = GLOB.gear_datums[href_list["toggle_gear"]]
if(TG.display_name in pref.gear)
pref.gear -= TG.display_name
else
var/total_cost = 0
for(var/gear_name in pref.gear)
var/datum/gear/G = gear_datums[gear_name]
var/datum/gear/G = GLOB.gear_datums[gear_name]
if(istype(G)) total_cost += G.cost
if((total_cost+TG.cost) <= GLOB.config.loadout_cost)
pref.gear += TG.display_name
return TOPIC_REFRESH_UPDATE_PREVIEW
if(href_list["gear"] && href_list["tweak"])
pref.gear_modified = TRUE
var/datum/gear/gear = gear_datums[href_list["gear"]]
var/datum/gear/gear = GLOB.gear_datums[href_list["gear"]]
var/datum/gear_tweak/tweak = locate(href_list["tweak"])
if(!tweak || !istype(gear) || !(tweak in gear.gear_tweaks))
return TOPIC_NOACTION
@@ -506,19 +506,19 @@ var/list/gear_datums = list()
var/obj/O = path
description = initial(O.desc)
if(flags & GEAR_HAS_COLOR_SELECTION)
gear_tweaks += list(gear_tweak_free_color_choice)
gear_tweaks += list(GLOB.gear_tweak_free_color_choice)
if(flags & GEAR_HAS_ALPHA_SELECTION)
gear_tweaks += list(gear_tweak_alpha_choice)
gear_tweaks += list(GLOB.gear_tweak_alpha_choice)
if(flags & GEAR_HAS_ACCENT_COLOR_SELECTION)
gear_tweaks += list(gear_tweak_accent_color)
gear_tweaks += list(GLOB.gear_tweak_accent_color)
if(flags & GEAR_HAS_NAME_SELECTION)
gear_tweaks += list(gear_tweak_free_name)
gear_tweaks += list(GLOB.gear_tweak_free_name)
if(flags & GEAR_HAS_DESC_SELECTION)
gear_tweaks += list(gear_tweak_free_desc)
gear_tweaks += list(GLOB.gear_tweak_free_desc)
if(flags & GEAR_HAS_COLOR_ROTATION_SELECTION)
gear_tweaks += list(gear_tweak_color_rotation)
gear_tweaks += list(GLOB.gear_tweak_color_rotation)
if(ispath(path, /obj/item/clothing/accessory))
gear_tweaks += list(gear_tweak_accessory_slot)
gear_tweaks += list(GLOB.gear_tweak_accessory_slot)
/datum/gear_data
var/path