diff --git a/code/_compile_options.dm b/code/_compile_options.dm index f25f39ab2b..61b66e90bc 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -15,7 +15,7 @@ //#define REFERENCE_TRACKING #ifdef REFERENCE_TRACKING -///alternate to reftracking, extool variant +///alternate to reftracking, extool variant (outdated, EoL, doesn't work, should be removed) //#define EXTOOLS_REFERENCE_TRACKING ///Should we be logging our findings or not diff --git a/code/_onclick/hud/radial.dm b/code/_onclick/hud/radial.dm index 77ee24b1ed..a582c372e1 100644 --- a/code/_onclick/hud/radial.dm +++ b/code/_onclick/hud/radial.dm @@ -9,6 +9,12 @@ GLOBAL_LIST_EMPTY(radial_menus) plane = ABOVE_HUD_PLANE var/datum/radial_menu/parent +/atom/movable/screen/radial/Destroy() + if(parent) + parent.elements -= src + UnregisterSignal(parent, COMSIG_PARENT_QDELETING) + . = ..() + /atom/movable/screen/radial/proc/set_parent(new_value) if(parent) UnregisterSignal(parent, COMSIG_PARENT_QDELETING) @@ -60,6 +66,11 @@ GLOBAL_LIST_EMPTY(radial_menus) if(usr.client == parent.current_user) parent.finished = TRUE +/atom/movable/screen/radial/center/Destroy() + if(parent) + parent.close_button = null + return ..() + /datum/radial_menu var/list/choices = list() //List of choice id's var/list/choices_icons = list() //choice_id -> icon @@ -292,6 +303,7 @@ GLOBAL_LIST_EMPTY(radial_menus) stoplag(1) /datum/radial_menu/Destroy() + QDEL_LIST(elements) Reset() hide() diff --git a/code/_rendering/atom_huds/atom_hud.dm b/code/_rendering/atom_huds/atom_hud.dm index 9cdf277c5f..151ebc8a24 100644 --- a/code/_rendering/atom_huds/atom_hud.dm +++ b/code/_rendering/atom_huds/atom_hud.dm @@ -55,11 +55,14 @@ GLOBAL_LIST_INIT(huds, list( GLOB.all_huds -= src return ..() -/datum/atom_hud/proc/remove_hud_from(mob/M) +/datum/atom_hud/proc/remove_hud_from(mob/M, absolute = FALSE) if(!M || !hudusers[M]) return - if (!--hudusers[M]) + if(absolute || !--hudusers[M]) + UnregisterSignal(M, COMSIG_PARENT_QDELETING) hudusers -= M + if(next_time_allowed[M]) + next_time_allowed -= M if(queued_to_see[M]) queued_to_see -= M else @@ -85,6 +88,7 @@ GLOBAL_LIST_INIT(huds, list( return if(!hudusers[M]) hudusers[M] = 1 + RegisterSignal(M, COMSIG_PARENT_QDELETING, .proc/unregister_mob) if(next_time_allowed[M] > world.time) if(!queued_to_see[M]) addtimer(CALLBACK(src, .proc/show_hud_images_after_cooldown, M), next_time_allowed[M] - world.time) @@ -96,6 +100,10 @@ GLOBAL_LIST_INIT(huds, list( else hudusers[M]++ +/datum/atom_hud/proc/unregister_mob(datum/source, force) + SIGNAL_HANDLER + remove_hud_from(source, TRUE) + /datum/atom_hud/proc/show_hud_images_after_cooldown(M) if(queued_to_see[M]) queued_to_see -= M diff --git a/code/datums/mind.dm b/code/datums/mind.dm index ac0d5d84f5..2abf605ea1 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -96,12 +96,8 @@ /datum/mind/Destroy() SSticker.minds -= src - if(islist(antag_datums)) - for(var/i in antag_datums) - var/datum/antagonist/antag_datum = i - if(antag_datum.delete_on_mind_deletion) - qdel(i) - antag_datums = null + QDEL_LIST(antag_datums) + QDEL_NULL(language_holder) QDEL_NULL(skill_holder) set_current(null) soulOwner = null diff --git a/code/datums/wounds/_wounds.dm b/code/datums/wounds/_wounds.dm index a2c4a70380..9b1a912f49 100644 --- a/code/datums/wounds/_wounds.dm +++ b/code/datums/wounds/_wounds.dm @@ -80,7 +80,7 @@ /// What kind of scars this wound will create description wise once healed var/scar_keyword = "generic" - /// If we've already tried scarring while removing (since remove_wound calls qdel, and qdel calls remove wound, .....) TODO: make this cleaner + /// If we've already tried scarring while removing (remove_wound can be called twice in a del chain, let's be nice to our code yeah?) TODO: make this cleaner var/already_scarred = FALSE /// If we forced this wound through badmin smite, we won't count it towards the round totals var/from_smite @@ -89,8 +89,7 @@ var/wound_flags = (FLESH_WOUND | BONE_WOUND | ACCEPTS_GAUZE) /datum/wound/Destroy() - if(limb?.wounds && (src in limb.wounds)) // destroy can call remove_wound() and remove_wound() calls qdel, so we check to make sure there's anything to remove first - remove_wound() + remove_wound() limb = null victim = null return ..() diff --git a/code/datums/wounds/slash.dm b/code/datums/wounds/slash.dm index 68740e78ab..02e3db3070 100644 --- a/code/datums/wounds/slash.dm +++ b/code/datums/wounds/slash.dm @@ -35,12 +35,24 @@ if(old_wound) blood_flow = max(old_wound.blood_flow, initial_flow) if(old_wound.severity > severity && old_wound.highest_scar) - highest_scar = old_wound.highest_scar - old_wound.highest_scar = null + set_highest_scar(old_wound.highest_scar) + old_wound.clear_highest_scar() if(!highest_scar) - highest_scar = new - highest_scar.generate(limb, src, add_to_scars=FALSE) + var/datum/scar/new_scar = new + set_highest_scar(new_scar) + new_scar.generate(limb, src, add_to_scars=FALSE) + +/datum/wound/slash/proc/set_highest_scar(datum/scar/new_scar) + if(highest_scar) + UnregisterSignal(highest_scar, COMSIG_PARENT_QDELETING) + if(new_scar) + RegisterSignal(new_scar, COMSIG_PARENT_QDELETING, .proc/clear_highest_scar) + highest_scar = new_scar + +/datum/wound/slash/proc/clear_highest_scar(datum/source) + SIGNAL_HANDLER + set_highest_scar(null) /datum/wound/slash/remove_wound(ignore_limb, replaced) if(!replaced && highest_scar) diff --git a/code/game/objects/effects/proximity.dm b/code/game/objects/effects/proximity.dm index 5c477501f4..26069d4255 100644 --- a/code/game/objects/effects/proximity.dm +++ b/code/game/objects/effects/proximity.dm @@ -109,6 +109,7 @@ return INITIALIZE_HINT_QDEL /obj/effect/abstract/proximity_checker/Destroy() + LAZYREMOVE(monitor.checkers, src) monitor = null return ..() diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm index 8f5e1c5079..62312e9099 100644 --- a/code/game/objects/structures/beds_chairs/bed.dm +++ b/code/game/objects/structures/beds_chairs/bed.dm @@ -185,7 +185,7 @@ anchored = FALSE buildstacktype = /obj/item/stack/sheet/mineral/wood buildstackamount = 10 - var/mob/living/owner = null + var/owned = FALSE /obj/structure/bed/dogbed/ian desc = "Ian's bed! Looks comfy." @@ -208,9 +208,12 @@ anchored = TRUE /obj/structure/bed/dogbed/proc/update_owner(mob/living/M) - owner = M + if(owned || type != /obj/structure/bed/dogbed) //Only marked beds work + return FALSE //Failed + owned = TRUE name = "[M]'s bed" desc = "[M]'s bed! Looks comfy." + return TRUE //Let any callers know that this bed is ours now /obj/structure/bed/dogbed/buckle_mob(mob/living/M, force, check_loc) . = ..() diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index db7f586642..7a53be231b 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -390,7 +390,7 @@ /obj/item/wisp_lantern/Destroy() if(wisp) if(wisp.loc == src) - qdel(wisp) + QDEL_NULL(wisp) else wisp.visible_message("[wisp] has a sad feeling for a moment, then it passes.") return ..() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index e5adf8229a..3d0361ca69 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -155,6 +155,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) addtimer(CALLBACK(src, /atom/proc/update_atom_colour), 10) /mob/dead/observer/Destroy() + if(data_huds_on) + remove_data_huds() GLOB.ghost_images_default -= ghostimage_default QDEL_NULL(ghostimage_default) diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index e4d042a4cc..45a3532359 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -91,8 +91,7 @@ . = ..() var/dog_area = get_area(src) for(var/obj/structure/bed/dogbed/D in dog_area) - if(!D.owner) - D.update_owner(src) + if(D.update_owner(src)) //No muscling in on my turf you fucking parrot break /mob/living/simple_animal/pet/dog/corgi/Initialize(mapload)