From 985f3401a9e95fec07165ee76a9f26cdf924f566 Mon Sep 17 00:00:00 2001 From: Cadyn <35672377+cadyn@users.noreply.github.com> Date: Wed, 10 Apr 2024 22:48:37 -0700 Subject: [PATCH] GC cleanup (#8211) --- code/controllers/subsystems/mobs.dm | 7 +++++++ code/controllers/subsystems/plants.dm | 3 ++- code/controllers/subsystems/radiation.dm | 7 +++++++ code/game/atoms_movable.dm | 1 + code/game/atoms_movable_ch.dm | 6 ++++++ code/modules/projectiles/projectile.dm | 2 +- modular_chomp/code/game/objects/effects/dark_growth.dm | 5 +++++ 7 files changed, 29 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystems/mobs.dm b/code/controllers/subsystems/mobs.dm index d0edcf7739..09433ee7ff 100644 --- a/code/controllers/subsystems/mobs.dm +++ b/code/controllers/subsystems/mobs.dm @@ -99,3 +99,10 @@ SUBSYSTEM_DEF(mobs) /datum/controller/subsystem/mobs/critfail() ..() log_recent() + +//CHOMPEdit Begin +//Mobs need to immediately removed from the SS list on Destroy +/mob/Destroy() + . = ..() + SSmobs.currentrun -= src +//CHOMPEdit End diff --git a/code/controllers/subsystems/plants.dm b/code/controllers/subsystems/plants.dm index 5827e9654a..4202ccd9d4 100644 --- a/code/controllers/subsystems/plants.dm +++ b/code/controllers/subsystems/plants.dm @@ -141,7 +141,8 @@ SUBSYSTEM_DEF(plants) return /datum/controller/subsystem/plants/proc/add_plant(var/obj/effect/plant/plant) - processing |= plant + if(!QDELETED(plant)) //CHOMPEdit GC + processing |= plant //CHOMPEdit GC /datum/controller/subsystem/plants/proc/remove_plant(var/obj/effect/plant/plant) processing -= plant diff --git a/code/controllers/subsystems/radiation.dm b/code/controllers/subsystems/radiation.dm index ca72077809..6a348a6e8b 100644 --- a/code/controllers/subsystems/radiation.dm +++ b/code/controllers/subsystems/radiation.dm @@ -146,3 +146,10 @@ SUBSYSTEM_DEF(radiation) return var/turf/epicentre = locate(round(world.maxx / 2), round(world.maxy / 2), source.z) flat_radiate(epicentre, power, world.maxx, respect_maint) + +//CHOMPEdit Begin +//Putting this here so it can be promptly nuked if I ever redo the radiation subsystem +/mob/living/Destroy() + . = ..() + SSradiation.listeners -= src +//CHOMPEdit End diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 5db4ebd772..a7e9884e54 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -45,6 +45,7 @@ render_target = ref(src) em_block = new(src, render_target) add_overlay(list(em_block), TRUE) + RegisterSignal(em_block, COMSIG_PARENT_QDELETING, PROC_REF(emblocker_gc)) //CHOMPEdit deal with emblocker deleting. see atoms_movable_ch.dm if(opacity) AddElement(/datum/element/light_blocking) if(icon_scale_x != DEFAULT_ICON_SCALE_X || icon_scale_y != DEFAULT_ICON_SCALE_Y || icon_rotation != DEFAULT_ICON_ROTATION) diff --git a/code/game/atoms_movable_ch.dm b/code/game/atoms_movable_ch.dm index 8d02ef8c03..fa2fd014c5 100644 --- a/code/game/atoms_movable_ch.dm +++ b/code/game/atoms_movable_ch.dm @@ -63,3 +63,9 @@ /atom/movable/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2) return + +/atom/movable/proc/emblocker_gc(var/datum/source) + UnregisterSignal(source, COMSIG_PARENT_QDELETING) + cut_overlay(source) + if(em_block == source) + em_block = null diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 6a8b387b54..116a11e8a8 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -469,7 +469,7 @@ impacted_mobs.Cut() impacted_mobs = null - qdel(trajectory) + QDEL_NULL(trajectory) //CHOMPEdit cleanup_beam_segments() if(my_case) diff --git a/modular_chomp/code/game/objects/effects/dark_growth.dm b/modular_chomp/code/game/objects/effects/dark_growth.dm index d52aebe328..f1510b73af 100644 --- a/modular_chomp/code/game/objects/effects/dark_growth.dm +++ b/modular_chomp/code/game/objects/effects/dark_growth.dm @@ -115,6 +115,11 @@ dark_tile.unlinked() return ..() +/obj/effect/dark/Destroy() + . = ..() + if(linked_node) + linked_node.children_effects -= src + /obj/effect/dark/process() set background = 1 var/turf/U = get_turf(src)