From bc6564deb6718c002256e43f1ae5772272efcf91 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Thu, 20 May 2021 15:04:37 -0400 Subject: [PATCH] Merge pull request #10335 from VOREStation/Arokha/dels Various qdel helpers --- code/_helpers/global_lists.dm | 3 +++ .../items/devices/communicator/communicator.dm | 2 +- .../objects/items/weapons/implants/implant.dm | 3 +++ .../objects/items/weapons/storage/storage.dm | 17 +++++++++++------ code/modules/mob/new_player/login.dm | 2 ++ code/modules/mob/new_player/logout.dm | 4 ++++ code/modules/mob/new_player/new_player.dm | 2 ++ code/modules/organs/organ_external.dm | 7 ++++++- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 063954d11b..ff3c65bfc8 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -111,6 +111,9 @@ GLOBAL_LIST_EMPTY(mannequins) M = GLOB.mannequins[ckey] return M +/proc/del_mannequin(var/ckey = "NULL") + GLOB.mannequins-= ckey + ////////////////////////// /////Initial Building///// ////////////////////////// diff --git a/code/game/objects/items/devices/communicator/communicator.dm b/code/game/objects/items/devices/communicator/communicator.dm index 6adbbf811c..038d9cb833 100644 --- a/code/game/objects/items/devices/communicator/communicator.dm +++ b/code/game/objects/items/devices/communicator/communicator.dm @@ -266,7 +266,7 @@ var/global/list/obj/item/device/communicator/all_communicators = list() . = ..() if(exonet) exonet.remove_address() - exonet = null + qdel_null(exonet) return ..() // Proc: register_device() diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index b06e92cc4a..c81f1d0ff5 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -119,6 +119,9 @@ GLOBAL_LIST_BOILERPLATE(all_tracking_implants, /obj/item/weapon/implant/tracking /obj/item/weapon/implant/tracking/Destroy() STOP_PROCESSING(SSobj, src) + if(part) + part.implants -= src + part = imp_in = null return ..() /obj/item/weapon/implant/tracking/process() diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 64de9b68a2..72070edf31 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -41,13 +41,18 @@ /obj/item/weapon/storage/Destroy() close_all() QDEL_NULL(boxes) - QDEL_NULL(src.storage_start) - QDEL_NULL(src.storage_continue) - QDEL_NULL(src.storage_end) - QDEL_NULL(src.stored_start) - QDEL_NULL(src.stored_continue) - QDEL_NULL(src.stored_end) + QDEL_NULL(storage_start) + QDEL_NULL(storage_continue) + QDEL_NULL(storage_end) + QDEL_NULL(stored_start) + QDEL_NULL(stored_continue) + QDEL_NULL(stored_end) QDEL_NULL(closer) + + if(ismob(loc)) + var/mob/M = loc + M.remove_from_mob(src) + . = ..() /obj/item/weapon/storage/MouseDrop(obj/over_object as obj) diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index 727146b2ef..0091774762 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -42,6 +42,8 @@ var/obj/effect/lobby_image = new /obj/effect/lobby_image sight |= SEE_TURFS player_list |= src + created_for = ckey + new_player_panel() spawn(40) if(client) diff --git a/code/modules/mob/new_player/logout.dm b/code/modules/mob/new_player/logout.dm index 99bd567cd5..5bc5054184 100644 --- a/code/modules/mob/new_player/logout.dm +++ b/code/modules/mob/new_player/logout.dm @@ -7,6 +7,10 @@ my_client = null ..() + + if(created_for) + del_mannequin(created_for) + if(!spawning)//Here so that if they are spawning and log out, the other procs can play out and they will have a mob to come back to. key = null//We null their key before deleting the mob, so they are properly kicked out. qdel(src) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 04577865e1..d200c89ec0 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -17,6 +17,8 @@ anchored = 1 // don't get pushed around + var/created_for + /mob/new_player/New() mob_list += src initialized = TRUE // Explicitly don't use Initialize(). New players join super early and use New() diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 246cb23d04..37e9429bf0 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -106,7 +106,12 @@ while(null in owner.organs) owner.organs -= null - implants.Cut() //VOREStation Add - Remove these too! + for(var/imp in implants) + var/obj/item/weapon/implant/I = imp + if(!istype(I)) + continue + I.imp_in = I.part = null + implants.Cut() return ..()