From 04374cc2c2f1cc4e6f43aa1e4045ba2bd863dd7a Mon Sep 17 00:00:00 2001 From: ShiftyRail <31417754+ShiftyRail@users.noreply.github.com> Date: Mon, 2 Jun 2025 13:48:03 +0100 Subject: [PATCH] More hard dels tracking (#37654) --- code/datums/gamemode/role/malf/hackabilities.dm | 6 ++++++ code/datums/gamemode/role/malf/hacking.dm | 2 +- code/game/atoms_movable.dm | 15 +++++++++------ code/game/machinery/machinery.dm | 1 + code/game/objects/items/devices/PDA/radio.dm | 4 ++++ code/game/objects/items/stacks/stack.dm | 1 - code/modules/mob/dead/observer/observer.dm | 5 ++++- code/modules/mob/living/living.dm | 5 +++++ code/modules/mob/mob.dm | 5 +++++ 9 files changed, 35 insertions(+), 9 deletions(-) diff --git a/code/datums/gamemode/role/malf/hackabilities.dm b/code/datums/gamemode/role/malf/hackabilities.dm index 00b09e778fd..b8391b33c7b 100644 --- a/code/datums/gamemode/role/malf/hackabilities.dm +++ b/code/datums/gamemode/role/malf/hackabilities.dm @@ -10,6 +10,12 @@ /datum/malfhack_ability/New(var/obj/machinery/M) machine = M +/datum/malfhack_ability/Destroy() + if (machine) // In case we got destroyed but the machine wasn't, this can happen in edge cases. + machine.hack_abilities -= src + machine = null + . = ..() + /datum/malfhack_ability/proc/activate(var/mob/living/silicon/A) var/datum/role/malfAI/M = A.mind.GetRole(MALF) if(!istype(A) || !istype(M)) diff --git a/code/datums/gamemode/role/malf/hacking.dm b/code/datums/gamemode/role/malf/hacking.dm index 3ef43954688..13bad47d226 100644 --- a/code/datums/gamemode/role/malf/hacking.dm +++ b/code/datums/gamemode/role/malf/hacking.dm @@ -9,7 +9,7 @@ var/malf_disrupted = FALSE var/aicontrolbypass = FALSE - var/hack_abilities = list( + var/list/hack_abilities = list( /datum/malfhack_ability/toggle/disable, /datum/malfhack_ability/oneuse/overload_quiet ) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index f5a257e7b73..1701f2d6a75 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -76,9 +76,6 @@ if (isturf(loc) && opacity) T = loc T.reconsider_lights() - var/turf/simulated/S = get_turf(src) - if (istype(S)) - S.zone?.burnable_atoms -= src if(materials) QDEL_NULL(materials) @@ -98,6 +95,9 @@ break_all_tethers() + for(var/atom/movable/AM in src) + qdel(AM) + forceMove(null, harderforce = TRUE) if (T) @@ -106,9 +106,6 @@ if(virtualhearer) QDEL_NULL(virtualhearer) - for(var/atom/movable/AM in src) - qdel(AM) - . = ..() /atom/movable/Del() @@ -482,6 +479,12 @@ var/list/atom/old_locs = locs //locs is implicitly copied on assignment, not aliased var/atom/old_loc = loc //Just for convenience; should be equivalent to old_locs[1]. var/list/atom/uncrossing + + if (destination == null) + var/turf/simulated/S = get_turf(old_loc) + if (istype(S)) + S.zone?.burnable_atoms -= src + if(isturf(loc)) //obounds() provides nonsense results when Ref.loc isn't a turf. uncrossing = obounds(src) else diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index ea142e0d008..64067949ecd 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -208,6 +208,7 @@ Class Procs: for(var/datum/malfhack_ability/MH in hack_abilities) MH.machine = null qdel(MH) + hack_abilities = null qdel(hack_overlay) ..() diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm index 2d187eaa6b3..179101ddd7e 100644 --- a/code/game/objects/items/devices/PDA/radio.dm +++ b/code/game/objects/items/devices/PDA/radio.dm @@ -31,6 +31,10 @@ if(ticker && ticker.current_state == GAME_STATE_PLAYING) initialize() +/obj/item/radio/integrated/signal/Destroy() + radio_controller.remove_object(src, frequency) + . = ..() + /obj/item/radio/integrated/signal/initialize() if (!radio_controller) return diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index f88f2256098..4227c007341 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -35,7 +35,6 @@ /obj/item/stack/Destroy() if (usr && usr.machine==src) usr << browse(null, "window=stack") - src.forceMove(null) ..() /obj/item/stack/examine(mob/user) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index e69144c8b53..e375a6d7bb2 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -132,11 +132,14 @@ var/creating_arena = FALSE ..() /mob/dead/observer/Destroy() - ..() + var/datum/gamemode/dynamic/dyn_mode = ticker.mode + if (istype(dyn_mode)) + dyn_mode.dead_players -= src unregister_event(/event/after_move, src, nameof(src::update_holomaps())) QDEL_NULL(station_holomap) ghostMulti = null observers.Remove(src) + return ..() /mob/dead/observer/proc/update_holomaps() if(station_holomap) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 826aadd893a..f5c3443ca17 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -26,6 +26,11 @@ if(addicted_chems) QDEL_NULL(addicted_chems) + + var/datum/gamemode/dynamic/dyn_mode = ticker.mode + if (istype(dyn_mode)) + dyn_mode.living_players -= src + . = ..() /mob/living/examine(var/mob/user, var/size = "", var/show_name = TRUE, var/show_icon = TRUE) //Show the mob's size and whether it's been butchered diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 35719239e7d..8af1f8f2221 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -53,6 +53,11 @@ attack_delayer = null special_delayer = null throw_delayer = null + + dark_plane = null + self_vision = null + master_plane = null + QDEL_NULL(hud_used) for(var/atom/movable/leftovers in src) qdel(leftovers)