mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Mob Ref Cleanup Part 3 (#22599)
Part 3 of the Mob Destroy Refactor, this time going through the entire list of every ref stored up to a mob/human, and (attempting) to verify and cleanup every possible circular ref. This PR also fixes some mistakes made with cleaning up UI elements, namely that tgui's really don't like it when you qdel them, and screen objects also weren't always clearing their own references if Qdel'ed directly. There were several niche situations too where circle refs might be retained by a mob. I also found an issue where static lights were only cleaned up on /atom/movable/ but actually existed farther up the chain on /atom. I don't know if any /atoms that aren't /atom/movable ever get static lights, but the fact that they can be needs to be correctly accounted for. I can't possibly have gotten all of them, but this is every single one I could find after 3 hours of work.
This commit is contained in:
@@ -528,6 +528,14 @@
|
||||
pickup_sound = 'sound/items/pickup/gloves.ogg'
|
||||
equip_sound = 'sound/items/equip/gloves.ogg'
|
||||
|
||||
/obj/item/clothing/gloves/Destroy()
|
||||
QDEL_NULL(cell)
|
||||
if (ring && wearer)
|
||||
wearer.equip_to_slot_if_possible(ring, slot_gloves)
|
||||
ring = null
|
||||
wearer = null
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/gloves/update_clothing_icon()
|
||||
if (ismob(src.loc))
|
||||
var/mob/M = src.loc
|
||||
@@ -948,6 +956,10 @@
|
||||
|
||||
var/footstep_sound_override
|
||||
|
||||
/obj/item/clothing/shoes/Destroy()
|
||||
QDEL_NULL(holding)
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/shoes/proc/draw_knife()
|
||||
set name = "Draw Boot Knife"
|
||||
set desc = "Pull out your boot knife."
|
||||
|
||||
@@ -166,9 +166,8 @@
|
||||
|
||||
|
||||
/obj/item/rig_module/Destroy()
|
||||
for(var/sm in stat_modules)
|
||||
qdel(sm)
|
||||
stat_modules.Cut()
|
||||
QDEL_LIST(stat_modules)
|
||||
holder?.installed_modules -= src
|
||||
holder = null
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -224,13 +224,22 @@
|
||||
piece.icon_supported_species_tags = icon_supported_species_tags
|
||||
|
||||
/obj/item/rig/Destroy()
|
||||
for(var/obj/item/piece in list(gloves,boots,helmet,chest))
|
||||
qdel(piece)
|
||||
STOP_PROCESSING(SSmobs, src)
|
||||
qdel(wires)
|
||||
wires = null
|
||||
qdel(spark_system)
|
||||
spark_system = null
|
||||
QDEL_NULL(air_supply)
|
||||
QDEL_NULL(boots)
|
||||
QDEL_NULL(chest)
|
||||
QDEL_NULL(helmet)
|
||||
QDEL_NULL(gloves)
|
||||
QDEL_NULL(cell)
|
||||
selected_module = null
|
||||
visor = null
|
||||
speech = null
|
||||
wearer?.wearing_rig = null
|
||||
wearer = null
|
||||
mob_icon = null
|
||||
QDEL_LIST(installed_modules)
|
||||
QDEL_NULL(wires)
|
||||
QDEL_NULL(spark_system)
|
||||
return ..()
|
||||
|
||||
/obj/item/rig/proc/set_vision(var/active)
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
|
||||
/atom
|
||||
///The light source, datum. Dont fuck with this directly
|
||||
var/tmp/datum/static_light_source/static_light
|
||||
///Static light sources currently attached to this atom, this includes ones owned by atoms inside this atom
|
||||
var/tmp/list/static_light_sources
|
||||
|
||||
///Pretty simple, just updates static lights on this atom
|
||||
/atom/proc/static_update_light()
|
||||
set waitfor = FALSE
|
||||
|
||||
+17
-2
@@ -54,6 +54,8 @@
|
||||
|
||||
QDEL_NULL(ability_master)
|
||||
QDEL_NULL(zone_sel)
|
||||
if (length(machine?.climbers))
|
||||
machine.climbers -= src
|
||||
machine = null
|
||||
|
||||
client_colors = null
|
||||
@@ -61,6 +63,7 @@
|
||||
pinned?.Cut()
|
||||
QDEL_LIST(embedded)
|
||||
languages?.Cut()
|
||||
holo?.clear_holo(src)
|
||||
holo = null
|
||||
l_hand = null
|
||||
r_hand = null
|
||||
@@ -104,11 +107,23 @@
|
||||
QDEL_LIST(click_handlers)
|
||||
vr_mob = null
|
||||
old_mob = null
|
||||
if (lastattacker && lastattacker.lastattacked == src)
|
||||
lastattacker.lastattacked = null
|
||||
if (lastattacked && lastattacked.lastattacker == src)
|
||||
lastattacked.lastattacker = null
|
||||
lastattacker = null
|
||||
lastattacked = null
|
||||
QDEL_NULL(pointing_effect)
|
||||
QDEL_LIST(open_nanouis)
|
||||
QDEL_LIST(tgui_open_uis)
|
||||
|
||||
// Cleanup for all UIs belonging to the client.
|
||||
// For performance reasons we check the length of the lists first since the lists can potentially either be null or empty.
|
||||
// But it's also plausible that they might contain null values, and while their aggressive checking means any valid entry in the list
|
||||
// is guaranteed to be of type /datum/tgui, null entries in the list can potentially exist and will pass the as anything typecast.
|
||||
if (length(tgui_open_uis))
|
||||
for (var/datum/tgui/ui as anything in tgui_open_uis)
|
||||
ui?.close()
|
||||
tgui_open_uis.Cut()
|
||||
|
||||
QDEL_NULL(narsimage)
|
||||
QDEL_NULL(narglow)
|
||||
QDEL_NULL(riftimage)
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/atom/movable
|
||||
/** Used to check wether or not an atom is being handled by SSfalling. */
|
||||
var/tmp/multiz_falling = 0
|
||||
|
||||
/**
|
||||
* Verb for the mob to move up a z-level if possible.
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
/atom/movable
|
||||
/// The mimic (if any) that's *directly* copying us.
|
||||
var/tmp/atom/movable/openspace/mimic/bound_overlay
|
||||
/// If TRUE, this atom is ignored by Z-Mimic.
|
||||
var/z_flags
|
||||
|
||||
/atom/movable/set_dir(ndir)
|
||||
. = ..()
|
||||
if (. && bound_overlay)
|
||||
|
||||
@@ -124,8 +124,7 @@
|
||||
addtimer(CALLBACK(src, PROC_REF(clear_screen)), 5)
|
||||
|
||||
/obj/item/organ/internal/brain/Destroy()
|
||||
if(brainmob)
|
||||
QDEL_NULL(brainmob)
|
||||
QDEL_NULL(brainmob)
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/internal/brain/removed(var/mob/living/user)
|
||||
|
||||
Reference in New Issue
Block a user