From ad7616b0eb5c487c156066df40586e13a7f6f3e1 Mon Sep 17 00:00:00 2001
From: CHOMPStation2StaffMirrorBot
<94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com>
Date: Sun, 1 Feb 2026 17:57:18 -0700
Subject: [PATCH] [MIRROR] some smaller cleanup (#12353)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
---
code/_helpers/_global_objects.dm | 2 ++
code/_helpers/global_lists.dm | 2 --
code/game/objects/structures/under_wardrobe.dm | 4 ++--
code/game/turfs/snow/snow.dm | 2 +-
code/modules/client/client procs.dm | 15 +++++++++++++--
.../preference_setup/loadout/01_equipment.dm | 10 +++++-----
.../ore_redemption_machine/equipment_vendor.dm | 2 ++
code/modules/mob/living/carbon/human/human.dm | 4 ++--
.../mob/living/carbon/human/human_bellies.dm | 2 +-
code/modules/mob/living/carbon/human/inventory.dm | 2 +-
code/modules/mob/living/carbon/human/stripping.dm | 2 +-
.../simple_mob/subtypes/mechanical/mecha/mecha.dm | 2 +-
code/modules/nifsoft/nif.dm | 5 +++--
.../projectiles/targeting/targeting_overlay.dm | 2 +-
code/modules/vore/eating/belly_import.dm | 4 ++--
.../panel_databackend/vorepanel_set_attribute.dm | 4 ++--
.../panel_databackend/vorepanel_vore_data.dm | 4 ++--
17 files changed, 41 insertions(+), 27 deletions(-)
diff --git a/code/_helpers/_global_objects.dm b/code/_helpers/_global_objects.dm
index 389bc85b01..a658bf3cbf 100644
--- a/code/_helpers/_global_objects.dm
+++ b/code/_helpers/_global_objects.dm
@@ -1,2 +1,4 @@
GLOBAL_DATUM_INIT(gear_tweak_free_color_choice, /datum/gear_tweak/color, new)
GLOBAL_DATUM_INIT(gear_tweak_implant_location, /datum/gear_tweak/implant_location, new)
+//Underwear
+GLOBAL_DATUM_INIT(global_underwear, /datum/category_collection/underwear, new)
diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm
index a1454ac105..1f8b74d949 100644
--- a/code/_helpers/global_lists.dm
+++ b/code/_helpers/global_lists.dm
@@ -63,8 +63,6 @@ GLOBAL_LIST_EMPTY(tail_styles_list) // Stores /datum/sprite_accessory/tail index
GLOBAL_LIST_EMPTY(wing_styles_list) // Stores /datum/sprite_accessory/wing indexed by type
GLOBAL_LIST_INIT(custom_species_bases, new) // Species that can be used for a Custom Species icon base
- //Underwear
-var/datum/category_collection/underwear/global_underwear = new()
//Customizables
GLOBAL_LIST_INIT(headsetlist, list("Standard","Bowman","Earbud"))
diff --git a/code/game/objects/structures/under_wardrobe.dm b/code/game/objects/structures/under_wardrobe.dm
index 6c8ae6e409..b13467fd4e 100644
--- a/code/game/objects/structures/under_wardrobe.dm
+++ b/code/game/objects/structures/under_wardrobe.dm
@@ -18,7 +18,7 @@
/obj/structure/undies_wardrobe/interact(var/mob/living/carbon/human/H)
var/dat = list()
dat += span_bold("Underwear:") + "
"
- for(var/datum/category_group/underwear/UWC in global_underwear.categories)
+ for(var/datum/category_group/underwear/UWC in GLOB.global_underwear.categories)
var/datum/category_item/underwear/UWI = H.all_underwear[UWC.name]
var/item_name = UWI ? UWI.name : "None"
dat += "[UWC.name]: [item_name]"
@@ -67,7 +67,7 @@
H.all_underwear -= href_list["remove_underwear"]
. = TRUE
else if(href_list["change_underwear"])
- var/datum/category_group/underwear/UWC = global_underwear.categories_by_name[href_list["change_underwear"]]
+ var/datum/category_group/underwear/UWC = GLOB.global_underwear.categories_by_name[href_list["change_underwear"]]
if(!UWC)
return
var/datum/category_item/underwear/selected_underwear = tgui_input_list(H, "Choose underwear:", "Choose underwear", UWC.items, H.all_underwear[UWC.name])
diff --git a/code/game/turfs/snow/snow.dm b/code/game/turfs/snow/snow.dm
index 6b9f4e39f7..d1a4b218f2 100644
--- a/code/game/turfs/snow/snow.dm
+++ b/code/game/turfs/snow/snow.dm
@@ -12,7 +12,7 @@
var/list/crossed_dirs = list()
/turf/snow/Entered(atom/A)
- if(ismob(A))
+ if(ismob(A) && !A.is_incorporeal())
var/mdir = "[A.dir]"
if(crossed_dirs[mdir])
crossed_dirs[mdir] = min(crossed_dirs[mdir] + 1, FOOTSTEP_SPRITE_AMT)
diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm
index d21b90074b..3b182801d1 100644
--- a/code/modules/client/client procs.dm
+++ b/code/modules/client/client procs.dm
@@ -462,7 +462,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
var/sql_ckey = sql_sanitize_text(src.ckey)
var/datum/db_query/query = SSdbcore.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
- query.Execute()
+ if(!query.Execute())
+ qdel(query)
+ return
var/sql_id = 0
player_age = 0 // New players won't have an entry so knowing we have a connection we set this to zero to be updated if their is a record.
while(query.NextRow())
@@ -474,11 +476,17 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
account_join_date = sanitizeSQL(findJoinDate())
if(account_join_date && SSdbcore.IsConnected())
var/datum/db_query/query_datediff = SSdbcore.NewQuery("SELECT DATEDIFF(Now(),'[account_join_date]')")
- if(query_datediff.Execute() && query_datediff.NextRow())
+ if(!query_datediff.Execute())
+ qdel(query)
+ return
+ if(query_datediff.NextRow())
account_age = text2num(query_datediff.item[1])
qdel(query_datediff)
var/datum/db_query/query_ip = SSdbcore.NewQuery("SELECT ckey FROM erro_player WHERE ip = '[address]'")
+ if(!query_ip.Execute())
+ qdel(query)
+ return
query_ip.Execute()
related_accounts_ip = ""
while(query_ip.NextRow())
@@ -487,6 +495,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
qdel(query_ip)
var/datum/db_query/query_cid = SSdbcore.NewQuery("SELECT ckey FROM erro_player WHERE computerid = '[computer_id]'")
+ if(!query_cid.Execute())
+ qdel(query)
+ return
query_cid.Execute()
related_accounts_cid = ""
while(query_cid.NextRow())
diff --git a/code/modules/client/preference_setup/loadout/01_equipment.dm b/code/modules/client/preference_setup/loadout/01_equipment.dm
index de33fdeb03..8a0fb78baa 100644
--- a/code/modules/client/preference_setup/loadout/01_equipment.dm
+++ b/code/modules/client/preference_setup/loadout/01_equipment.dm
@@ -39,7 +39,7 @@
character.all_underwear_metadata.Cut()
for(var/underwear_category_name in pref.all_underwear)
- var/datum/category_group/underwear/underwear_category = global_underwear.categories_by_name[underwear_category_name]
+ var/datum/category_group/underwear/underwear_category = GLOB.global_underwear.categories_by_name[underwear_category_name]
if(underwear_category)
var/underwear_item_name = pref.all_underwear[underwear_category_name]
character.all_underwear[underwear_category_name] = underwear_category.items_by_name[underwear_item_name]
@@ -65,7 +65,7 @@
if(!istype(pref.all_underwear))
pref.all_underwear = list()
- for(var/datum/category_group/underwear/WRC in global_underwear.categories)
+ for(var/datum/category_group/underwear/WRC in GLOB.global_underwear.categories)
for(var/datum/category_item/underwear/WRI in WRC.items)
if(WRI.is_default(pref.identifying_gender ? pref.identifying_gender : MALE))
pref.all_underwear[WRC.name] = WRI.name
@@ -75,7 +75,7 @@
pref.all_underwear_metadata = list()
for(var/underwear_category in pref.all_underwear)
- var/datum/category_group/underwear/UWC = global_underwear.categories_by_name[underwear_category]
+ var/datum/category_group/underwear/UWC = GLOB.global_underwear.categories_by_name[underwear_category]
if(!UWC)
pref.all_underwear -= underwear_category
else
@@ -95,7 +95,7 @@
var/list/data = ..()
var/list/underwear_data = list()
- for(var/datum/category_group/underwear/UWC in global_underwear.categories)
+ for(var/datum/category_group/underwear/UWC in GLOB.global_underwear.categories)
var/item_name = LAZYACCESS(pref.all_underwear, UWC.name) || "None"
var/list/tweaks = list()
@@ -183,7 +183,7 @@
return TOPIC_REFRESH_UPDATE_PREVIEW
if("change_underwear")
- var/datum/category_group/underwear/UWC = LAZYACCESS(global_underwear.categories_by_name, params["underwear"])
+ var/datum/category_group/underwear/UWC = LAZYACCESS(GLOB.global_underwear.categories_by_name, params["underwear"])
if(!UWC)
return
var/datum/category_item/underwear/selected_underwear = tgui_input_list(user, "Choose underwear:", "Character Preference", UWC.items, pref.all_underwear[UWC.name])
diff --git a/code/modules/mining/ore_redemption_machine/equipment_vendor.dm b/code/modules/mining/ore_redemption_machine/equipment_vendor.dm
index d76f315238..f27f457739 100644
--- a/code/modules/mining/ore_redemption_machine/equipment_vendor.dm
+++ b/code/modules/mining/ore_redemption_machine/equipment_vendor.dm
@@ -168,6 +168,7 @@
if(inserted_id && !powered())
visible_message(span_notice("The ID slot indicator light flickers on \the [src] as it spits out a card before powering down."))
inserted_id.forceMove(get_turf(src))
+ inserted_id = null
/obj/machinery/mineral/equipment_vendor/update_icon()
if(panel_open)
@@ -307,6 +308,7 @@
/obj/machinery/mineral/equipment_vendor/dismantle()
if(inserted_id)
inserted_id.forceMove(loc) //Prevents deconstructing the ORM from deleting whatever ID was inside it.
+ inserted_id = null
. = ..()
/**
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index aeda7483d9..8d81901b98 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -58,7 +58,7 @@
. = ..()
hide_underwear.Cut()
- for(var/category in global_underwear.categories_by_name)
+ for(var/category in GLOB.global_underwear.categories_by_name)
hide_underwear[category] = FALSE
if(dna)
@@ -1617,7 +1617,7 @@
set category = "Object"
if(stat) return
- var/datum/category_group/underwear/UWC = tgui_input_list(usr, "Choose underwear:", "Show/hide underwear", global_underwear.categories)
+ var/datum/category_group/underwear/UWC = tgui_input_list(usr, "Choose underwear:", "Show/hide underwear", GLOB.global_underwear.categories)
if(!UWC) return
var/datum/category_item/underwear/UWI = all_underwear[UWC.name]
if(!UWI || UWI.name == "None")
diff --git a/code/modules/mob/living/carbon/human/human_bellies.dm b/code/modules/mob/living/carbon/human/human_bellies.dm
index 2720b4b2a2..5619bd27ac 100644
--- a/code/modules/mob/living/carbon/human/human_bellies.dm
+++ b/code/modules/mob/living/carbon/human/human_bellies.dm
@@ -8,7 +8,7 @@
//update_vore_belly_sprite()
var/list/new_fullness = ..(TRUE)
. = new_fullness
- for(var/datum/category_group/underwear/undergarment_class in global_underwear.categories)
+ for(var/datum/category_group/underwear/undergarment_class in GLOB.global_underwear.categories)
if(!new_fullness[undergarment_class.name])
continue
new_fullness[undergarment_class.name] = -1 * round(-1 * new_fullness[undergarment_class.name]) // Doing a ceiling the only way BYOND knows how I guess
diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm
index eb7a85a833..4826f599cf 100644
--- a/code/modules/mob/living/carbon/human/inventory.dm
+++ b/code/modules/mob/living/carbon/human/inventory.dm
@@ -439,6 +439,6 @@ This saves us from having to call add_fingerprint() any time something is put in
continue
drop_from_inventory(equipped_thing)
if(remove_underwear)
- for(var/datum/category_group/underwear/UWC in global_underwear.categories)
+ for(var/datum/category_group/underwear/UWC in GLOB.global_underwear.categories)
hide_underwear[UWC.name] = TRUE
update_underwear(1)
diff --git a/code/modules/mob/living/carbon/human/stripping.dm b/code/modules/mob/living/carbon/human/stripping.dm
index c5c75d0d41..263fcbf3b9 100644
--- a/code/modules/mob/living/carbon/human/stripping.dm
+++ b/code/modules/mob/living/carbon/human/stripping.dm
@@ -54,7 +54,7 @@
update_inv_w_uniform()
return
if("underwear")
- var/datum/category_group/underwear/UWC = tgui_input_list(user, "Choose underwear. (Do not do this without OOC permission from the other player)", "Show/hide underwear", global_underwear.categories)
+ var/datum/category_group/underwear/UWC = tgui_input_list(user, "Choose underwear. (Do not do this without OOC permission from the other player)", "Show/hide underwear", GLOB.global_underwear.categories)
if(!UWC) return
var/datum/category_item/underwear/UWI = all_underwear[UWC.name]
if(!UWI || UWI.name == "None")
diff --git a/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/mecha.dm b/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/mecha.dm
index 96aa77a299..cd6423bbf6 100644
--- a/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/mecha.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/mechanical/mecha/mecha.dm
@@ -66,7 +66,7 @@
..(0,"explodes!") // Do everything else first.
// Make the exploding more convincing with an actual explosion and some sparks.
- sparks.start()
+ sparks?.start()
explosion(get_turf(src), 0, 0, 1, 3)
// 'Eject' our pilot, if one exists.
diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm
index a202b19de6..7830cb716a 100644
--- a/code/modules/nifsoft/nif.dm
+++ b/code/modules/nifsoft/nif.dm
@@ -107,8 +107,9 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
//Destructor cleans up references
/obj/item/nif/Destroy()
- unregister_human()
- human = null
+ if(human)
+ unregister_human()
+ human = null
QDEL_LIST_NULL(nifsofts)
QDEL_NULL(comm)
nifsofts_life.Cut()
diff --git a/code/modules/projectiles/targeting/targeting_overlay.dm b/code/modules/projectiles/targeting/targeting_overlay.dm
index 46281e3508..6cab0459b1 100644
--- a/code/modules/projectiles/targeting/targeting_overlay.dm
+++ b/code/modules/projectiles/targeting/targeting_overlay.dm
@@ -105,7 +105,7 @@
qdel(src)
return
- if(!aiming_at)
+ if(QDELETED(aiming_at))
cancel_aiming()
return
diff --git a/code/modules/vore/eating/belly_import.dm b/code/modules/vore/eating/belly_import.dm
index 65407aea90..e023050695 100644
--- a/code/modules/vore/eating/belly_import.dm
+++ b/code/modules/vore/eating/belly_import.dm
@@ -744,12 +744,12 @@
if(istext(belly_data["undergarment_chosen"]))
var/new_undergarment_chosen = sanitize(belly_data["undergarment_chosen"],MAX_MESSAGE_LEN,0,0,0)
if(new_undergarment_chosen)
- for(var/datum/category_group/underwear/U in global_underwear.categories)
+ for(var/datum/category_group/underwear/U in GLOB.global_underwear.categories)
if(lowertext(U.name) == lowertext(new_undergarment_chosen))
new_belly.undergarment_chosen = U.name
break
- var/datum/category_group/underwear/UWC = global_underwear.categories_by_name[new_belly.undergarment_chosen]
+ var/datum/category_group/underwear/UWC = GLOB.global_underwear.categories_by_name[new_belly.undergarment_chosen]
var/invalid_if_none = TRUE
for(var/datum/category_item/underwear/U in UWC.items)
if(lowertext(U.name) == lowertext(new_belly.undergarment_if_none))
diff --git a/code/modules/vore/eating/panel_databackend/vorepanel_set_attribute.dm b/code/modules/vore/eating/panel_databackend/vorepanel_set_attribute.dm
index fba180f2b6..333aa6e0d3 100644
--- a/code/modules/vore/eating/panel_databackend/vorepanel_set_attribute.dm
+++ b/code/modules/vore/eating/panel_databackend/vorepanel_set_attribute.dm
@@ -990,13 +990,13 @@
. = TRUE
if("b_undergarment_choice")
var/new_undergarment = params["val"]
- if(!(global_underwear.categories_by_name[new_undergarment]))
+ if(!(GLOB.global_underwear.categories_by_name[new_undergarment]))
return FALSE
host.vore_selected.undergarment_chosen = new_undergarment
host.handle_belly_update()
. = TRUE
if("b_undergarment_if_none")
- var/datum/category_group/underwear/UWC = global_underwear.categories_by_name[host.vore_selected.undergarment_chosen]
+ var/datum/category_group/underwear/UWC = GLOB.global_underwear.categories_by_name[host.vore_selected.undergarment_chosen]
var/selected_underwear = UWC.items_by_name[params["val"]]
if(!selected_underwear) //They cancelled, no changes
return FALSE
diff --git a/code/modules/vore/eating/panel_databackend/vorepanel_vore_data.dm b/code/modules/vore/eating/panel_databackend/vorepanel_vore_data.dm
index 5346605e29..5f6bf5961c 100644
--- a/code/modules/vore/eating/panel_databackend/vorepanel_vore_data.dm
+++ b/code/modules/vore/eating/panel_databackend/vorepanel_vore_data.dm
@@ -269,7 +269,7 @@
for(var/flag_name in selected.vore_sprite_flag_list)
UNTYPED_LIST_ADD(vs_flags, list("label" = flag_name, "selection" = selected.vore_sprite_flags & selected.vore_sprite_flag_list[flag_name]))
- var/datum/category_group/underwear/UWC = global_underwear.categories_by_name[host.vore_selected.undergarment_chosen]
+ var/datum/category_group/underwear/UWC = GLOB.global_underwear.categories_by_name[host.vore_selected.undergarment_chosen]
var/list/undergarments
if(UWC)
undergarments = UWC.items
@@ -299,7 +299,7 @@
"belly_sprite_options" = host.vore_icon_bellies,
"undergarment_chosen" = selected.undergarment_chosen,
"undergarment_if_none" = selected.undergarment_if_none || "None",
- "undergarment_options" = global_underwear.categories,
+ "undergarment_options" = GLOB.global_underwear.categories,
"undergarment_options_if_none" = undergarments,
"undergarment_color" = selected.undergarment_color,
"tail_option_shown" = ishuman(owner),