diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index 0795d7bb78c..9be310c94ef 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -22,6 +22,8 @@
#define BLOCK_GAS_SMOKE_EFFECT 8192 // blocks the effect that chemical clouds would have on a mob --glasses, mask and helmets ONLY!
#define THICKMATERIAL 8192 //prevents syringes, parapens and hypos if the external suit or helmet (if targeting head) has this flag. Example: space suits, biosuit, bombsuits, thick suits that cover your body. (NOTE: flag shared with BLOCK_GAS_SMOKE_EFFECT)
+#define DROPDEL 16384 // When dropped, it calls qdel on itself
+
//Reagent flags
#define REAGENT_NOREACT 1
diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm
index 02c2954b61f..5ab67ffb611 100644
--- a/code/_onclick/telekinesis.dm
+++ b/code/_onclick/telekinesis.dm
@@ -62,9 +62,9 @@ var/const/tk_maxrange = 15
desc = "Magic"
icon = 'icons/obj/magic.dmi'//Needs sprites
icon_state = "2"
- flags = NOBLUDGEON | ABSTRACT
+ flags = NOBLUDGEON | ABSTRACT | DROPDEL
//item_state = null
- w_class = 10
+ w_class = WEIGHT_CLASS_GIGANTIC
layer = 20
plane = HUD_PLANE
@@ -82,9 +82,8 @@ var/const/tk_maxrange = 15
/obj/item/tk_grab/dropped(mob/user)
if(focus && user && loc != user && loc != user.loc) // drop_item() gets called when you tk-attack a table/closet with an item
if(focus.Adjacent(loc))
- focus.loc = loc
-
- qdel(src)
+ focus.forceMove(loc)
+ . = ..()
//stops TK grabs being equipped anywhere but into hands
diff --git a/code/game/gamemodes/changeling/powers/mutations.dm b/code/game/gamemodes/changeling/powers/mutations.dm
index fc00cfff19c..0b36449c54a 100644
--- a/code/game/gamemodes/changeling/powers/mutations.dm
+++ b/code/game/gamemodes/changeling/powers/mutations.dm
@@ -125,7 +125,7 @@
icon = 'icons/obj/weapons.dmi'
icon_state = "arm_blade"
item_state = "arm_blade"
- flags = ABSTRACT | NODROP
+ flags = ABSTRACT | NODROP | DROPDEL
w_class = WEIGHT_CLASS_HUGE
sharp = 1
force = 25
@@ -140,7 +140,7 @@
/obj/item/weapon/melee/arm_blade/dropped(mob/user)
user.visible_message("With a sickening crunch, [user] reforms his blade into an arm!", "We assimilate the blade back into our body.", "You prepare to extend a tentacle.")
-/obj/item/weapon/gun/magic/tentacle/dropped()
- . = ..()
- qdel(src)
-
/obj/item/weapon/gun/magic/tentacle/shoot_with_empty_chamber(mob/living/user as mob|obj)
to_chat(user, "The [name] is not ready yet.")
@@ -377,7 +373,7 @@
/obj/item/weapon/shield/changeling
name = "shield-like mass"
desc = "A mass of tough, boney tissue. You can still see the fingers as a twisted pattern in the shield."
- flags = NODROP
+ flags = NODROP | DROPDEL
icon = 'icons/obj/weapons.dmi'
icon_state = "ling_shield"
block_chance = 50
@@ -389,9 +385,6 @@
if(ismob(loc))
loc.visible_message("The end of [loc.name]\'s hand inflates rapidly, forming a huge shield-like mass!", "We inflate our hand into a strong shield.", "You hear organic matter ripping and tearing!")
-/obj/item/weapon/shield/changeling/dropped()
- qdel(src)
-
/obj/item/weapon/shield/changeling/hit_reaction()
if(remaining_uses < 1)
if(ishuman(loc))
@@ -429,7 +422,7 @@
name = "flesh mass"
icon_state = "lingspacesuit"
desc = "A huge, bulky mass of pressure and temperature-resistant organic tissue, evolved to facilitate space travel."
- flags = STOPSPRESSUREDMAGE | NODROP
+ flags = STOPSPRESSUREDMAGE | NODROP | DROPDEL
allowed = list(/obj/item/device/flashlight, /obj/item/weapon/tank/emergency_oxygen, /obj/item/weapon/tank/oxygen)
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0) //No armor at all.
@@ -439,9 +432,6 @@
loc.visible_message("[loc.name]\'s flesh rapidly inflates, forming a bloated mass around their body!", "We inflate our flesh, creating a spaceproof suit!", "You hear organic matter ripping and tearing!")
processing_objects += src
-/obj/item/clothing/suit/space/changeling/dropped()
- qdel(src)
-
/obj/item/clothing/suit/space/changeling/process()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
@@ -451,12 +441,9 @@
name = "flesh mass"
icon_state = "lingspacehelmet"
desc = "A covering of pressure and temperature-resistant organic tissue with a glass-like chitin front."
- flags = BLOCKHAIR | STOPSPRESSUREDMAGE | NODROP
+ flags = BLOCKHAIR | STOPSPRESSUREDMAGE | NODROP | DROPDEL
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
-/obj/item/clothing/head/helmet/space/changeling/dropped()
- qdel(src)
-
/***************************************\
|*****************ARMOR*****************|
@@ -481,7 +468,7 @@
name = "chitinous mass"
desc = "A tough, hard covering of black chitin."
icon_state = "lingarmor"
- flags = NODROP
+ flags = NODROP | DROPDEL
body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS
armor = list(melee = 40, bullet = 40, laser = 40, energy = 20, bomb = 10, bio = 4, rad = 0)
flags_inv = HIDEJUMPSUIT
@@ -495,16 +482,10 @@
if(ismob(loc))
loc.visible_message("[loc.name]\'s flesh turns black, quickly transforming into a hard, chitinous mass!", "We harden our flesh, creating a suit of armor!", "You hear organic matter ripping and tearing!")
-/obj/item/clothing/suit/armor/changeling/dropped()
- qdel(src)
-
/obj/item/clothing/head/helmet/changeling
name = "chitinous mass"
desc = "A tough, hard covering of black chitin with transparent chitin in front."
icon_state = "lingarmorhelmet"
- flags = BLOCKHAIR | NODROP
+ flags = BLOCKHAIR | NODROP | DROPDEL
armor = list(melee = 30, bullet = 30, laser = 40, energy = 20, bomb = 10, bio = 4, rad = 0)
- flags_inv = HIDEEARS
-
-/obj/item/clothing/head/helmet/changeling/dropped()
- qdel(src)
+ flags_inv = HIDEEARS
\ No newline at end of file
diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm
index 00592b7812d..057de105c41 100644
--- a/code/game/gamemodes/cult/cult_items.dm
+++ b/code/game/gamemodes/cult/cult_items.dm
@@ -361,32 +361,16 @@
/obj/item/weapon/melee/cultblade/ghost
name = "eldritch sword"
force = 15
- flags = NODROP
-
-/obj/item/weapon/melee/cultblade/ghost/dropped(mob/living/carbon/human/user)
- ..()
- qdel(src)
+ flags = NODROP | DROPDEL
/obj/item/clothing/head/culthood/alt/ghost
- flags = NODROP
-
-/obj/item/clothing/head/culthood/alt/ghost/dropped(mob/living/carbon/human/user)
- ..()
- qdel(src)
+ flags = NODROP | DROPDEL
/obj/item/clothing/suit/cultrobes/alt/ghost
- flags = NODROP
-
-/obj/item/clothing/suit/cultrobes/alt/ghost/dropped(mob/living/carbon/human/user)
- ..()
- qdel(src)
+ flags = NODROP | DROPDEL
/obj/item/clothing/shoes/cult/ghost
- flags = NODROP
-
-/obj/item/clothing/shoes/cult/ghost/dropped(mob/living/carbon/human/user)
- ..()
- qdel(src)
+ flags = NODROP | DROPDEL
/datum/outfit/ghost_cultist
name = "Cultist Ghost"
diff --git a/code/game/gamemodes/cult/talisman.dm b/code/game/gamemodes/cult/talisman.dm
index b85f60bb5a3..152c5e57994 100644
--- a/code/game/gamemodes/cult/talisman.dm
+++ b/code/game/gamemodes/cult/talisman.dm
@@ -412,7 +412,11 @@
trashtype = /obj/item/weapon/restraints/handcuffs/energy/used
origin_tech = "materials=2;magnets=5"
+/obj/item/weapon/restraints/handcuffs/energy/used
+ desc = "energy discharge"
+ flags = DROPDEL
+
/obj/item/weapon/restraints/handcuffs/energy/cult/used/dropped(mob/user)
user.visible_message("[user]'s shackles shatter in a discharge of dark magic!", \
"Your [src] shatters in a discharge of dark magic!")
- qdel(src)
+ . = ..()
\ No newline at end of file
diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
index c8bc0e1e15e..f6dc76c7b27 100644
--- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
+++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
@@ -454,6 +454,7 @@ Congratulations! You are now trained for invasive xenobiology research!"}
/obj/item/weapon/restraints/handcuffs/energy/used
desc = "energy discharge"
+ flags = DROPDEL
/obj/item/weapon/restraints/handcuffs/energy/used/dropped(mob/user)
user.visible_message("[user]'s [src] break in a discharge of energy!", \
@@ -461,7 +462,7 @@ Congratulations! You are now trained for invasive xenobiology research!"}
var/datum/effect_system/spark_spread/S = new
S.set_up(4,0,user.loc)
S.start()
- qdel(src)
+ . = ..()
/obj/item/weapon/abductor_baton/examine(mob/user)
..()
diff --git a/code/game/gamemodes/wizard/godhand.dm b/code/game/gamemodes/wizard/godhand.dm
index 16f9adb8dd9..979a28379ea 100644
--- a/code/game/gamemodes/wizard/godhand.dm
+++ b/code/game/gamemodes/wizard/godhand.dm
@@ -7,7 +7,7 @@
icon = 'icons/obj/weapons.dmi'
icon_state = "syndballoon"
item_state = null
- flags = ABSTRACT | NODROP
+ flags = ABSTRACT | NODROP | DROPDEL
w_class = WEIGHT_CLASS_HUGE
force = 0
throwforce = 0
@@ -32,10 +32,10 @@
attached_spell.attached_hand = null
qdel(src)
-/obj/item/weapon/melee/touch_attack/dropped()
+/obj/item/weapon/melee/touch_attack/Destroy()
if(attached_spell)
attached_spell.attached_hand = null
- qdel(src)
+ return ..()
/obj/item/weapon/melee/touch_attack/disintegrate
name = "disintegrating touch"
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 88769dcbb6d..e2d94b3f701 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -101,6 +101,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
new path(src)
/obj/item/Destroy()
+ flags &= ~DROPDEL //prevent reqdels
QDEL_NULL(hidden_uplink)
if(ismob(loc))
var/mob/m = loc
@@ -317,6 +318,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
for(var/X in actions)
var/datum/action/A = X
A.Remove(user)
+ if(DROPDEL & flags)
+ qdel(src)
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
diff --git a/code/game/objects/items/weapons/chrono_eraser.dm b/code/game/objects/items/weapons/chrono_eraser.dm
index ef1e2c91498..d1c052828f9 100644
--- a/code/game/objects/items/weapons/chrono_eraser.dm
+++ b/code/game/objects/items/weapons/chrono_eraser.dm
@@ -47,7 +47,7 @@
icon_state = "chronogun"
item_state = "chronogun"
w_class = WEIGHT_CLASS_NORMAL
- flags = NODROP
+ flags = NODROP | DROPDEL
ammo_type = list(/obj/item/ammo_casing/energy/chrono_beam)
can_charge = 0
fire_delay = 50
@@ -63,10 +63,6 @@
TED = new(src.loc)
qdel(src)
-/obj/item/weapon/gun/energy/chrono_gun/dropped()
- ..()
- qdel(src)
-
/obj/item/weapon/gun/energy/chrono_gun/update_icon()
return
diff --git a/code/game/objects/items/weapons/holy_weapons.dm b/code/game/objects/items/weapons/holy_weapons.dm
index d721aadfbed..59335cb1c3f 100644
--- a/code/game/objects/items/weapons/holy_weapons.dm
+++ b/code/game/objects/items/weapons/holy_weapons.dm
@@ -70,7 +70,7 @@
icon_state = "disintegrate"
item_state = "disintegrate"
desc = "This hand of yours glows with an awesome power!"
- flags = ABSTRACT | NODROP
+ flags = ABSTRACT | NODROP| DROPDEL
w_class = WEIGHT_CLASS_HUGE
hitsound = 'sound/weapons/sear.ogg'
damtype = BURN
diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm
index 8109e8e8b86..13826f34564 100644
--- a/code/game/objects/items/weapons/implants/implant.dm
+++ b/code/game/objects/items/weapons/implants/implant.dm
@@ -11,6 +11,7 @@
item_color = "b"
var/allow_multiple = 0
var/uses = -1
+ flags = DROPDEL
/obj/item/weapon/implant/proc/trigger(emote, mob/source)
@@ -82,6 +83,5 @@
return "No information available"
/obj/item/weapon/implant/dropped(mob/user)
- ..()
. = 1
- qdel(src)
+ ..()
\ No newline at end of file
diff --git a/code/game/objects/items/weapons/legcuffs.dm b/code/game/objects/items/weapons/legcuffs.dm
index 21d8828310f..ae738b3ccd0 100644
--- a/code/game/objects/items/weapons/legcuffs.dm
+++ b/code/game/objects/items/weapons/legcuffs.dm
@@ -128,19 +128,18 @@
armed = 1
icon_state = "e_snare"
trap_damage = 0
+ flags = DROPDEL
/obj/item/weapon/restraints/legcuffs/beartrap/energy/New()
..()
- spawn(100)
- if(!istype(loc, /mob))
- var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
- sparks.set_up(1, 1, src)
- sparks.start()
- qdel(src)
+ addtimer(src, "dissipate", 100)
-/obj/item/weapon/restraints/legcuffs/beartrap/energy/dropped()
- ..()
- qdel(src)
+/obj/item/weapon/restraints/legcuffs/beartrap/energy/proc/dissipate()
+ if(!ismob(loc))
+ var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
+ sparks.set_up(1, 1, src)
+ sparks.start()
+ qdel(src)
/obj/item/weapon/restraints/legcuffs/beartrap/energy/attack_hand(mob/user)
Crossed(user) //honk
diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm
index caa39be73e2..01379abb0c0 100644
--- a/code/game/objects/items/weapons/twohanded.dm
+++ b/code/game/objects/items/weapons/twohanded.dm
@@ -79,7 +79,6 @@
var/obj/item/weapon/twohanded/offhand/O = new(user) ////Let's reserve his other hand~
O.name = "[name] - offhand"
O.desc = "Your second grip on the [name]"
- O.wielded = TRUE
user.put_in_inactive_hand(O)
return
@@ -115,18 +114,12 @@
name = "offhand"
flags = ABSTRACT
-/obj/item/weapon/twohanded/offhand/Destroy()
- wielded = FALSE
- return ..()
-
/obj/item/weapon/twohanded/offhand/unwield()
- if(wielded)//Only delete if we're wielded
- wielded = FALSE
+ if(!QDELETED(src))
qdel(src)
/obj/item/weapon/twohanded/offhand/wield()
- if(wielded)//Only delete if we're wielded
- wielded = FALSE
+ if(!QDELETED(src))
qdel(src)
///////////Two hand required objects///////////////
diff --git a/code/modules/clothing/masks/miscellaneous.dm b/code/modules/clothing/masks/miscellaneous.dm
index dcdf7c9d7b2..43a8676bb29 100644
--- a/code/modules/clothing/masks/miscellaneous.dm
+++ b/code/modules/clothing/masks/miscellaneous.dm
@@ -94,6 +94,7 @@
w_class = WEIGHT_CLASS_TINY
resist_time = 150
mute = MUTE_MUFFLE
+ flags = DROPDEL
species_fit = list("Vox", "Unathi", "Tajaran", "Vulpkanin", "Grey")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/mask.dmi',
@@ -109,9 +110,8 @@
R.loc = T
transfer_fingerprints_to(R)
playsound(src,'sound/items/poster_ripped.ogg',40,1)
- spawn(0) // Because of how dropping is done, if the muzzle gets deleted now, icons won't properly update and the whole unEquip() proc will break stuff.
- qdel(src) // This makes sure it gets deleted AFTER all that has to be done is done.
- user.emote("scream")
+ user.emote("scream")
+ . = ..()
/obj/item/clothing/mask/muzzle/safety
name = "safety muzzle"
diff --git a/code/modules/mob/living/simple_animal/tribbles.dm b/code/modules/mob/living/simple_animal/tribbles.dm
index dfe4715edd5..5ea4225b1ad 100644
--- a/code/modules/mob/living/simple_animal/tribbles.dm
+++ b/code/modules/mob/living/simple_animal/tribbles.dm
@@ -93,13 +93,13 @@ var/global/totaltribbles = 0 //global variable so it updates for all tribbles,
item_state = "tribble1"
w_class = 10
var/gestation = 0
+ flags = DROPDEL
/obj/item/toy/tribble/attack_self(mob/user as mob) //hug that tribble (and play a sound if we add one)
..()
to_chat(user, "You nuzzle the tribble and it trills softly.")
/obj/item/toy/tribble/dropped(mob/user as mob) //now you can't item form them to get rid of them all so easily
- ..()
new /mob/living/simple_animal/tribble(user.loc)
for(var/mob/living/simple_animal/tribble/T in user.loc)
T.icon_state = src.icon_state
@@ -108,7 +108,7 @@ var/global/totaltribbles = 0 //global variable so it updates for all tribbles,
T.gestation = src.gestation
to_chat(user, "The tribble gets up and wanders around.")
- qdel(src)
+ . = ..()
/obj/item/toy/tribble/attackby(var/obj/item/weapon/O as obj, var/mob/user as mob) //neutering and un-neutering
..()
diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm
index 4b41b5084c6..df36f552c3e 100644
--- a/code/modules/mob/mob_grab.dm
+++ b/code/modules/mob/mob_grab.dm
@@ -434,7 +434,8 @@
return EAT_TIME_FAT //if it doesn't fit into the above, it's probably a fat guy, take EAT_TIME_FAT to do it
/obj/item/weapon/grab/dropped()
- qdel(src)
+ if(!QDELETED(src))
+ qdel(src)
/obj/item/weapon/grab/Destroy()