diff --git a/code/__HELPERS/qdel.dm b/code/__HELPERS/qdel.dm
index 2aea6de0dd7..8171dd66427 100644
--- a/code/__HELPERS/qdel.dm
+++ b/code/__HELPERS/qdel.dm
@@ -2,4 +2,4 @@
#define QDEL_NULL(item) if(item) { qdel(item); item = null }
#define QDEL_LIST(L) if(L) { for(var/I in L) qdel(I); L.Cut(); }
#define QDEL_LIST_ASSOC(L) if(L) { for(var/I in L) { qdel(L[I]); qdel(I); } L.Cut(); }
-#define QDEL_LIST_ASSOC_VAL(L) if(L) { for(var/I in L) qel(L[I]); L.Cut(); }
+#define QDEL_LIST_ASSOC_VAL(L) if(L) { for(var/I in L) qdel(L[I]); L.Cut(); }
diff --git a/code/game/gamemodes/changeling/powers/revive.dm b/code/game/gamemodes/changeling/powers/revive.dm
index 892c89fdd3a..5fd98986332 100644
--- a/code/game/gamemodes/changeling/powers/revive.dm
+++ b/code/game/gamemodes/changeling/powers/revive.dm
@@ -37,27 +37,27 @@
// isn't, but I don't want to remove it, just in case.
for(var/organ_name in H.bodyparts_by_name)
var/obj/item/organ/external/O = H.bodyparts_by_name[organ_name]
- if(!O) continue
+ if(!O)
+ continue
for(var/obj/item/weapon/shard/shrapnel/s in O.implants)
- if(istype(s))
- O.implants -= s
- H.contents -= s
- qdel(s)
+ O.implants -= s
+ H.contents -= s
+ qdel(s)
O.brute_dam = 0
O.burn_dam = 0
O.damage_state = "00"
O.germ_level = 0
- O.hidden = null
+ QDEL_NULL(O.hidden)
O.number_wounds = 0
O.open = 0
O.perma_injury = 0
O.status = 0
- O.trace_chemicals = list()
- O.wounds = list()
+ O.trace_chemicals.Cut()
+ QDEL_LIST(O.wounds)
O.wound_update_accuracy = 1
for(var/obj/item/organ/internal/IO in H.internal_organs)
IO.damage = 0
- IO.trace_chemicals = list()
+ IO.trace_chemicals.Cut()
H.updatehealth()
to_chat(user, "We have regenerated.")
diff --git a/code/game/objects/items/devices/autopsy.dm b/code/game/objects/items/devices/autopsy.dm
index 7ebf13e538b..2839715d7d7 100644
--- a/code/game/objects/items/devices/autopsy.dm
+++ b/code/game/objects/items/devices/autopsy.dm
@@ -7,16 +7,24 @@
w_class = WEIGHT_CLASS_TINY
origin_tech = "materials=1;biotech=1"
var/list/datum/autopsy_data_scanner/wdata = list()
- var/list/datum/autopsy_data_scanner/chemtraces = list()
+ var/list/chemtraces = list()
var/target_name = null
var/timeofdeath = null
+/obj/item/weapon/autopsy_scanner/Destroy()
+ QDEL_LIST_ASSOC_VAL(wdata)
+ return ..()
+
/datum/autopsy_data_scanner
var/weapon = null // this is the DEFINITE weapon type that was used
var/list/organs_scanned = list() // this maps a number of scanned organs to
// the wounds to those organs with this data's weapon type
var/organ_names = ""
+/datum/autopsy_data_scanner/Destroy()
+ QDEL_LIST_ASSOC_VAL(organs_scanned)
+ return ..()
+
/datum/autopsy_data
var/weapon = null
var/pretend_weapon = null
diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm
index dd0c9655384..1af9e92b233 100644
--- a/code/modules/surgery/organs/organ.dm
+++ b/code/modules/surgery/organs/organ.dm
@@ -32,6 +32,14 @@ var/list/organ_cache = list()
var/sterile = 0 //can the organ be infected by germs?
var/tough = 0 //can organ be easily damaged?
+/obj/item/organ/Destroy()
+ processing_objects.Remove(src)
+ if(owner)
+ remove(owner, 1)
+ QDEL_LIST_ASSOC_VAL(autopsy_data)
+ QDEL_NULL(dna)
+ return ..()
+
/obj/item/organ/proc/update_health()
return
diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm
index 10f50cceaea..fa955c8ea98 100644
--- a/code/modules/surgery/organs/organ_external.dm
+++ b/code/modules/surgery/organs/organ_external.dm
@@ -71,11 +71,11 @@
/obj/item/organ/external/necrotize(update_sprite=TRUE)
if(status & (ORGAN_ROBOT|ORGAN_DEAD))
return
- to_chat(owner, "You can't feel your [name] anymore...")
status |= ORGAN_DEAD
if(dead_icon)
icon_state = dead_icon
if(owner)
+ to_chat(owner, "You can't feel your [name] anymore...")
owner.update_body(update_sprite)
owner.bad_external_organs |= src
if(vital)
@@ -85,6 +85,8 @@
if(parent && parent.children)
parent.children -= src
+ parent = null
+
if(internal_organs)
for(var/obj/item/organ/internal/O in internal_organs)
internal_organs -= O
@@ -102,6 +104,12 @@
deltimer(wound_cleanup_timer)
wound_cleanup_timer = null
+ QDEL_LIST(wounds)
+
+ QDEL_LIST(implants)
+
+ QDEL_NULL(hidden)
+
return ..()
/obj/item/organ/external/attackby(obj/item/weapon/W as obj, mob/user as mob)
diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm
index 6c775862373..7bea9c480af 100644
--- a/code/modules/surgery/organs/organ_internal.dm
+++ b/code/modules/surgery/organs/organ_internal.dm
@@ -15,11 +15,6 @@
if(istype(holder))
insert(holder)
-/obj/item/organ/internal/Destroy()
- if(owner)
- remove(owner, 1)
- return ..()
-
/obj/item/organ/internal/proc/insert(mob/living/carbon/M, special = 0, var/dont_remove_slot = 0)
if(!iscarbon(M) || owner == M)
return
@@ -120,12 +115,6 @@
reagents.add_reagent("nutriment", 5)
-
-/obj/item/organ/internal/Destroy()
- if(owner)
- remove(owner, 1)
- return ..()
-
/obj/item/organ/internal/attack(mob/living/carbon/M, mob/user)
if(M == user && ishuman(user))
var/mob/living/carbon/human/H = user
@@ -296,21 +285,18 @@
// . = ..()
-/obj/item/organ/internal/lungs/process()
+/obj/item/organ/internal/lungs/on_life()
..()
-
- if(!owner)
- return
if(germ_level > INFECTION_LEVEL_ONE)
if(prob(5))
owner.emote("cough") //respitory tract infection
if(is_bruised())
if(prob(2))
- spawn owner.custom_emote(1, "coughs up blood!")
+ owner.custom_emote(1, "coughs up blood!")
owner.drip(10)
if(prob(4))
- spawn owner.custom_emote(1, "gasps for air!")
+ owner.custom_emote(1, "gasps for air!")
owner.AdjustLoseBreath(5)
/obj/item/organ/internal/kidneys
@@ -321,13 +307,8 @@
parent_organ = "groin"
slot = "kidneys"
-/obj/item/organ/internal/kidneys/process()
-
+/obj/item/organ/internal/kidneys/on_life()
..()
-
- if(!owner)
- return
-
// Coffee is really bad for you with busted kidneys.
// This should probably be expanded in some way, but fucked if I know
// what else kidneys can process in our reagent list.
@@ -439,12 +420,8 @@
slot = "liver"
var/alcohol_intensity = 1
-/obj/item/organ/internal/liver/process()
+/obj/item/organ/internal/liver/on_life()
..()
-
- if(!owner)
- return
-
if(germ_level > INFECTION_LEVEL_ONE)
if(prob(1))
to_chat(owner, " Your skin itches.")
diff --git a/code/modules/surgery/organs/subtypes/misc.dm b/code/modules/surgery/organs/subtypes/misc.dm
deleted file mode 100644
index be76fa907dc..00000000000
--- a/code/modules/surgery/organs/subtypes/misc.dm
+++ /dev/null
@@ -1,66 +0,0 @@
-//CORTICAL BORER ORGANS.
-/obj/item/organ/internal/borer
- name = "cortical borer"
- icon = 'icons/obj/objects.dmi'
- icon_state = "borer"
- parent_organ = "head"
- organ_tag = "brain"
- slot = "borer"
- vital = 1
-
-/obj/item/organ/internal/borer/process()
-
- // Borer husks regenerate health, feel no pain, and are resistant to stuns and brainloss.
- for(var/chem in list("saline", "sailcylic", "meth", "mannitol"))
- if(owner.reagents.get_reagent_amount(chem) < 3)
- owner.reagents.add_reagent(chem, 5)
-
- // They're also super gross and ooze ichor.
- if(prob(5))
- var/mob/living/carbon/human/H = owner
- if(!istype(H))
- return
-
- var/datum/reagent/blood/B = locate(/datum/reagent/blood) in H.vessel.reagent_list
- blood_splatter(H,B,1)
- var/obj/effect/decal/cleanable/blood/splatter/goo = locate() in get_turf(owner)
- if(goo)
- goo.name = "husk ichor"
- goo.desc = "It's thick and stinks of decay."
- goo.basecolor = "#412464"
- goo.update_icon()
-
-/obj/item/organ/internal/borer/remove(var/mob/living/user)
-
- ..()
-
- var/mob/living/simple_animal/borer/B = owner.has_brain_worms()
- if(B)
- B.leave_host()
- B.ckey = owner.ckey
-
- spawn(0)
- qdel(src)
- return null
-
-//VOX ORGANS.
-/obj/item/organ/internal/stack
- name = "cortical stack"
- icon_state = "brain-prosthetic"
- parent_organ = "head"
- organ_tag = "stack"
- slot = "vox_stack"
- robotic = 2
- vital = 1
- var/backup_time = 0
- var/datum/mind/backup
-
-/obj/item/organ/internal/stack/process()
- if(owner && owner.stat != 2 && !is_broken())
- backup_time = world.time
- if(owner.mind) backup = owner.mind
-
-/obj/item/organ/internal/stack/vox
- name = "vox cortical stack"
-
-/obj/item/organ/internal/stack/vox/stack
diff --git a/code/modules/surgery/organs/subtypes/vox.dm b/code/modules/surgery/organs/subtypes/vox.dm
index f0b94e2963e..bb56c41030d 100644
--- a/code/modules/surgery/organs/subtypes/vox.dm
+++ b/code/modules/surgery/organs/subtypes/vox.dm
@@ -1,3 +1,16 @@
/obj/item/organ/internal/liver/vox
alcohol_intensity = 1.6
species = "Vox"
+
+
+/obj/item/organ/internal/stack
+ name = "cortical stack"
+ icon_state = "brain-prosthetic"
+ parent_organ = "head"
+ organ_tag = "stack"
+ slot = "vox_stack"
+ robotic = 2
+ vital = 1
+
+/obj/item/organ/internal/stack/vox
+ name = "vox cortical stack"
\ No newline at end of file
diff --git a/paradise.dme b/paradise.dme
index 5d94ed67f86..ffe53541474 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -2185,7 +2185,6 @@
#include "code\modules\surgery\organs\subtypes\grey.dm"
#include "code\modules\surgery\organs\subtypes\kidan.dm"
#include "code\modules\surgery\organs\subtypes\machine.dm"
-#include "code\modules\surgery\organs\subtypes\misc.dm"
#include "code\modules\surgery\organs\subtypes\nucleation.dm"
#include "code\modules\surgery\organs\subtypes\shadow.dm"
#include "code\modules\surgery\organs\subtypes\skrell.dm"