[MIRROR] Moves destroy_on_drop to TG style and adds signal (#11640)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-09-14 02:41:28 -07:00
committed by GitHub
parent e62583c5c4
commit e97dd3d6e2
17 changed files with 40 additions and 72 deletions

View File

@@ -46,6 +46,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define ALLOW_SURVIVALFOOD (1<<5) // Allows special survival food items to be eaten through it #define ALLOW_SURVIVALFOOD (1<<5) // Allows special survival food items to be eaten through it
#define INFINITE_AIR (1<<6) // Provides an infinite air supply. #define INFINITE_AIR (1<<6) // Provides an infinite air supply.
#define NOSTRIP (1<<7) // Items that should never get stripped #define NOSTRIP (1<<7) // Items that should never get stripped
#define DROPDEL (1<<8) // Items that delete upon being dropped
// Flags for pass_flags. - Used in /atom/var/pass_flags // Flags for pass_flags. - Used in /atom/var/pass_flags
#define PASSTABLE (1<<0) #define PASSTABLE (1<<0)

View File

@@ -66,16 +66,13 @@
var/last_throw = 0 var/last_throw = 0
var/atom/movable/focus = null var/atom/movable/focus = null
var/mob/living/host = null var/mob/living/host = null
item_flags = DROPDEL | NOSTRIP
/obj/item/tk_grab/dropped(mob/user) /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 && user && loc != user && loc != user.loc) // drop_item() gets called when you tk-attack a table/closet with an item
if(focus.Adjacent(loc)) if(focus.Adjacent(loc))
focus.loc = loc focus.loc = loc
loc = null
spawn(1)
qdel(src)
return
//stops TK grabs being equipped anywhere but into hands //stops TK grabs being equipped anywhere but into hands
/obj/item/tk_grab/equipped(var/mob/user, var/slot) /obj/item/tk_grab/equipped(var/mob/user, var/slot)

View File

@@ -61,12 +61,11 @@
icon_state = "arm_blade" icon_state = "arm_blade"
w_class = ITEMSIZE_HUGE w_class = ITEMSIZE_HUGE
force = 5 force = 5
anchored = TRUE
throwforce = 0 //Just to be on the safe side throwforce = 0 //Just to be on the safe side
throw_range = 0 throw_range = 0
throw_speed = 0 throw_speed = 0
embed_chance = 0 //No embedding. embed_chance = 0 //No embedding.
destroy_on_drop = TRUE item_flags = DROPDEL | NOSTRIP
var/mob/living/creator //This is just like ninja swords, needed to make sure dumb shit that removes the sword doesn't make it stay around. var/mob/living/creator //This is just like ninja swords, needed to make sure dumb shit that removes the sword doesn't make it stay around.
var/weapType = "weapon" var/weapType = "weapon"
var/weapLocation = "arm" var/weapLocation = "arm"

View File

@@ -38,7 +38,7 @@
desc = "A huge, bulky mass of pressure and temperature-resistant organic tissue, evolved to facilitate space travel." desc = "A huge, bulky mass of pressure and temperature-resistant organic tissue, evolved to facilitate space travel."
flags = 0 //Not THICKMATERIAL because it's organic tissue, so if somebody tries to inject something into it, flags = 0 //Not THICKMATERIAL because it's organic tissue, so if somebody tries to inject something into it,
//it still ends up in your blood. (also balance but muh fluff) //it still ends up in your blood. (also balance but muh fluff)
destroy_on_drop = TRUE item_flags = THICKMATERIAL | DROPDEL | NOSTRIP
allowed = list(POCKET_GENERIC, POCKET_ALL_TANKS) allowed = list(POCKET_GENERIC, POCKET_ALL_TANKS)
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) //No armor at all. armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) //No armor at all.
canremove = FALSE canremove = FALSE
@@ -58,7 +58,7 @@
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
body_parts_covered = HEAD|FACE|EYES body_parts_covered = HEAD|FACE|EYES
canremove = FALSE canremove = FALSE
destroy_on_drop = TRUE item_flags = THICKMATERIAL | AIRTIGHT | ALLOW_SURVIVALFOOD | DROPDEL | NOSTRIP
/obj/item/clothing/shoes/magboots/changeling /obj/item/clothing/shoes/magboots/changeling
desc = "A suction cupped mass of flesh, shaped like a foot." desc = "A suction cupped mass of flesh, shaped like a foot."
@@ -66,7 +66,7 @@
icon_state = "lingspacesuit" icon_state = "lingspacesuit"
actions_types = list(/datum/action/item_action/toggle_grippers) actions_types = list(/datum/action/item_action/toggle_grippers)
canremove = FALSE canremove = FALSE
destroy_on_drop = TRUE item_flags = DROPDEL | NOSTRIP
/obj/item/clothing/shoes/magboots/changeling/set_slowdown() /obj/item/clothing/shoes/magboots/changeling/set_slowdown()
slowdown = shoes? max(SHOES_SLOWDOWN, shoes.slowdown): SHOES_SLOWDOWN //So you can't put on magboots to make you walk faster. slowdown = shoes? max(SHOES_SLOWDOWN, shoes.slowdown): SHOES_SLOWDOWN //So you can't put on magboots to make you walk faster.

View File

@@ -91,7 +91,7 @@
icon = 'icons/obj/weapons.dmi' icon = 'icons/obj/weapons.dmi'
icon_state = "electric_hand" icon_state = "electric_hand"
show_examine = FALSE show_examine = FALSE
destroy_on_drop = TRUE item_flags = DROPDEL | NOSTRIP
var/shock_cost = 10 var/shock_cost = 10
var/agony_amount = 60 var/agony_amount = 60

View File

@@ -31,6 +31,7 @@
icon = 'icons/obj/weapons.dmi' icon = 'icons/obj/weapons.dmi'
icon_state = "electric_hand" icon_state = "electric_hand"
show_examine = FALSE show_examine = FALSE
item_flags = DROPDEL | NOSTRIP
/obj/item/finger_lockpick/Initialize(mapload) /obj/item/finger_lockpick/Initialize(mapload)
. = ..() . = ..()
@@ -40,9 +41,6 @@
/obj/item/finger_lockpick/dropped(mob/user) /obj/item/finger_lockpick/dropped(mob/user)
..() ..()
to_chat(user, span_notice("We discreetly shape our finger back to a less suspicious form.")) to_chat(user, span_notice("We discreetly shape our finger back to a less suspicious form."))
spawn(1)
if(src)
qdel(src)
/obj/item/finger_lockpick/afterattack(var/atom/target, var/mob/living/user, proximity) /obj/item/finger_lockpick/afterattack(var/atom/target, var/mob/living/user, proximity)
if(!target) if(!target)

View File

@@ -7,6 +7,7 @@
slot_l_hand_str = 'icons/mob/items/lefthand_spells.dmi', slot_l_hand_str = 'icons/mob/items/lefthand_spells.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_spells.dmi', slot_r_hand_str = 'icons/mob/items/righthand_spells.dmi',
) )
item_flags = DROPDEL | NOSTRIP
throwforce = 0 throwforce = 0
force = 0 force = 0
show_examine = FALSE show_examine = FALSE
@@ -278,15 +279,6 @@
qdel(S) qdel(S)
return 0 return 0
// Proc: dropped()
// Parameters: 0
// Description: Deletes the spell object immediately.
/obj/item/spell/dropped(mob/user)
..()
spawn(1)
if(src)
qdel(src)
// Proc: throw_impact() // Proc: throw_impact()
// Parameters: 1 (hit_atom - the atom that got hit by the spell as it was thrown) // Parameters: 1 (hit_atom - the atom that got hit by the spell as it was thrown)
// Description: Calls on_throw_cast() on whatever was hit, then deletes itself incase it missed. // Description: Calls on_throw_cast() on whatever was hit, then deletes itself incase it missed.

View File

@@ -299,6 +299,3 @@ Buildable meters
playsound(src, W.usesound, 50, 1) playsound(src, W.usesound, 50, 1)
to_chat(user, span_notice("You fasten the meter to the pipe.")) to_chat(user, span_notice("You fasten the meter to the pipe."))
qdel(src) qdel(src)
/obj/item/pipe_gsensor/dropped(mob/user)
. = ..()

View File

@@ -129,7 +129,6 @@
var/list/warned_of_possession //Checks to see who has been informed this item is possessed. var/list/warned_of_possession //Checks to see who has been informed this item is possessed.
var/cleaving = FALSE // Used to avoid infinite cleaving. var/cleaving = FALSE // Used to avoid infinite cleaving.
var/list/tool_qualities var/list/tool_qualities
var/destroy_on_drop = FALSE // Used by augments to determine if the item should destroy itself when dropped, or return to its master.
var/obj/item/organ/my_augment = null // Used to reference the object's host organ. var/obj/item/organ/my_augment = null // Used to reference the object's host organ.
var/datum/identification/identity = null var/datum/identification/identity = null
var/identity_type = /datum/identification var/identity_type = /datum/identification
@@ -429,6 +428,14 @@
for(var/datum/action/action_item_has as anything in actions) for(var/datum/action/action_item_has as anything in actions)
action_item_has.Remove(user) action_item_has.Remove(user)
if((item_flags & DROPDEL) && !QDELETED(src))
qdel(src)
SEND_SIGNAL(src, COMSIG_ITEM_DROPPED, user)
if(my_augment && !QDELETED(src))
forceMove(my_augment)
// called just as an item is picked up (loc is not yet changed) // called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user) /obj/item/proc/pickup(mob/user)
SEND_SIGNAL(src, COMSIG_ITEM_PICKUP, user) SEND_SIGNAL(src, COMSIG_ITEM_PICKUP, user)

View File

@@ -301,6 +301,7 @@ var/last_chew = 0
use_time = 0 use_time = 0
breakouttime = 30 breakouttime = 30
cuff_sound = 'sound/weapons/towelwipe.ogg' //Is there anything this sound can't do? cuff_sound = 'sound/weapons/towelwipe.ogg' //Is there anything this sound can't do?
item_flags = DROPDEL
/obj/item/handcuffs/legcuffs/bola/can_place(var/mob/target, var/mob/user) /obj/item/handcuffs/legcuffs/bola/can_place(var/mob/target, var/mob/user)
if(user) //A ranged legcuff, until proper implementation as items it remains a projectile-only thing. if(user) //A ranged legcuff, until proper implementation as items it remains a projectile-only thing.
@@ -309,7 +310,6 @@ var/last_chew = 0
/obj/item/handcuffs/legcuffs/bola/dropped(mob/user) /obj/item/handcuffs/legcuffs/bola/dropped(mob/user)
..() ..()
visible_message(span_infoplain(span_bold("\The [src]") + " falls apart!")) visible_message(span_infoplain(span_bold("\The [src]") + " falls apart!"))
qdel(src)
/obj/item/handcuffs/legcuffs/bola/place_legcuffs(var/mob/living/carbon/target, var/mob/user) /obj/item/handcuffs/legcuffs/bola/place_legcuffs(var/mob/living/carbon/target, var/mob/user)
playsound(src, cuff_sound, 30, 1, -2) playsound(src, cuff_sound, 30, 1, -2)

View File

@@ -407,6 +407,7 @@
active_armourpen = 25 active_armourpen = 25
projectile_parry_chance = 40 projectile_parry_chance = 40
colorable = TRUE colorable = TRUE
item_flags = DROPDEL | NOSTRIP
hitcost = 75 hitcost = 75
@@ -422,6 +423,7 @@
desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal." desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
icon_state = "blade" icon_state = "blade"
item_state = "blade" item_state = "blade"
item_flags = DROPDEL | NOSTRIP
force = 40 //Normal attacks deal very high damage - about the same as wielded fire axe force = 40 //Normal attacks deal very high damage - about the same as wielded fire axe
armor_penetration = 100 armor_penetration = 100
sharp = TRUE sharp = TRUE
@@ -455,10 +457,6 @@
user.drop_from_inventory(src) user.drop_from_inventory(src)
QDEL_IN(src, 1) QDEL_IN(src, 1)
/obj/item/melee/energy/blade/dropped(mob/user)
..()
QDEL_IN(src, 1)
/obj/item/melee/energy/blade/process() /obj/item/melee/energy/blade/process()
if(!creator || loc != creator || !creator.item_is_in_hands(src)) if(!creator || loc != creator || !creator.item_is_in_hands(src))
// Tidy up a bit. // Tidy up a bit.

View File

@@ -3,6 +3,7 @@
desc = "Deployable mop." desc = "Deployable mop."
icon = 'icons/obj/janitor.dmi' icon = 'icons/obj/janitor.dmi'
icon_state = "mop" icon_state = "mop"
item_flags = DROPDEL | NOSTRIP
force = 3 force = 3
anchored = TRUE // Never spawned outside of inventory, should be fine. anchored = TRUE // Never spawned outside of inventory, should be fine.
throwforce = 1 //Throwing or dropping the item deletes it. throwforce = 1 //Throwing or dropping the item deletes it.
@@ -57,10 +58,6 @@
user.drop_from_inventory(src) user.drop_from_inventory(src)
spawn(1) if(!QDELETED(src)) qdel(src) spawn(1) if(!QDELETED(src)) qdel(src)
/obj/item/mop_deploy/dropped(mob/user)
..()
spawn(1) if(!QDELETED(src)) qdel(src)
/obj/item/mop_deploy/process() /obj/item/mop_deploy/process()
if(!creator || loc != creator || !creator.item_is_in_hands(src)) if(!creator || loc != creator || !creator.item_is_in_hands(src))
// Tidy up a bit. // Tidy up a bit.

View File

@@ -612,9 +612,6 @@
W.add_fingerprint(user) W.add_fingerprint(user)
return handle_item_insertion(W) return handle_item_insertion(W)
/obj/item/storage/dropped(mob/user)
return ..()
/obj/item/storage/attack_hand(mob/user as mob) /obj/item/storage/attack_hand(mob/user as mob)
if(ishuman(user) && !pocketable) if(ishuman(user) && !pocketable)
var/mob/living/carbon/human/H = user var/mob/living/carbon/human/H = user

View File

@@ -115,14 +115,22 @@ var/list/slot_equipment_priority = list( \
//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success. //Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success.
/mob/proc/put_in_l_hand(var/obj/item/W) /mob/proc/put_in_l_hand(var/obj/item/W)
if(!istype(W)) if(!istype(W))
return 0 return FALSE
return 1 if(QDELETED(W))
if(!(W.item_flags & DROPDEL))
log_runtime("[src] tried to pick up a qdeleted object [W]")
return FALSE
return TRUE
//Puts the item into your r_hand if possible and calls all necessary triggers/updates. returns 1 on success. //Puts the item into your r_hand if possible and calls all necessary triggers/updates. returns 1 on success.
/mob/proc/put_in_r_hand(var/obj/item/W) /mob/proc/put_in_r_hand(var/obj/item/W)
if(!istype(W)) if(!istype(W))
return 0 return FALSE
return 1 if(QDELETED(W))
if(!(W.item_flags & DROPDEL))
log_runtime("[src] tried to pick up a qdeleted object [W]")
return FALSE
return TRUE
//Puts the item into our active hand if possible. returns 1 on success. //Puts the item into our active hand if possible. returns 1 on success.
/mob/proc/put_in_active_hand(var/obj/item/W) /mob/proc/put_in_active_hand(var/obj/item/W)

View File

@@ -87,7 +87,7 @@
if(stripping) if(stripping)
if(!istype(target_slot)) // They aren't holding anything valid and there's nothing to remove, why are we even here? if(!istype(target_slot)) // They aren't holding anything valid and there's nothing to remove, why are we even here?
return return
if(!target_slot.canremove) if(!target_slot.canremove || (target_slot.item_flags & NOSTRIP))
to_chat(user, span_warning("You cannot remove \the [src]'s [target_slot.name].")) to_chat(user, span_warning("You cannot remove \the [src]'s [target_slot.name]."))
return return
visible_message(span_danger("\The [user] is trying to remove \the [src]'s [target_slot.name]!")) visible_message(span_danger("\The [user] is trying to remove \the [src]'s [target_slot.name]!"))

View File

@@ -18,7 +18,7 @@
name = "grab" name = "grab"
icon = 'icons/mob/screen1.dmi' icon = 'icons/mob/screen1.dmi'
icon_state = "reinforce" icon_state = "reinforce"
flags = 0 item_flags = DROPDEL | NOSTRIP
var/obj/screen/grab/hud = null var/obj/screen/grab/hud = null
var/mob/living/affecting = null var/mob/living/affecting = null
var/mob/living/carbon/human/assailant = null var/mob/living/carbon/human/assailant = null
@@ -33,7 +33,6 @@
abstract = 1 abstract = 1
item_state = "nothing" item_state = "nothing"
w_class = ITEMSIZE_HUGE w_class = ITEMSIZE_HUGE
destroy_on_drop = TRUE //VOREStation Edit
/obj/item/grab/Initialize(mapload, mob/victim) /obj/item/grab/Initialize(mapload, mob/victim)
@@ -340,12 +339,6 @@
if(I_DISARM) if(I_DISARM)
pin_down(affecting, assailant) pin_down(affecting, assailant)
/obj/item/grab/dropped(mob/user)
..()
loc = null
if(!QDELETED(src))
qdel(src)
/obj/item/grab/proc/reset_kill_state() /obj/item/grab/proc/reset_kill_state()
if(state == GRAB_KILL) if(state == GRAB_KILL)
var/datum/gender/T = GLOB.gender_datums[assailant.get_visible_gender()] var/datum/gender/T = GLOB.gender_datums[assailant.get_visible_gender()]

View File

@@ -75,23 +75,9 @@
item_to_equip = integrated_object_type item_to_equip = integrated_object_type
if(ispath(item_to_equip)) if(ispath(item_to_equip))
owner.equip_augment_item(target_slot, item_to_equip, silent_deploy, FALSE) owner.equip_augment_item(target_slot, item_to_equip, silent_deploy)
else if(item_to_equip) else if(item_to_equip)
owner.equip_augment_item(target_slot, item_to_equip, silent_deploy, FALSE, src) owner.equip_augment_item(target_slot, item_to_equip, silent_deploy, src)
/*
* The delicate handling of augment-controlled items.
*/
// Attaches to the end of dropped items' code.
/obj/item/dropped(mob/user)
. = ..(user)
if(src)
if(destroy_on_drop && !QDELETED(src))
qdel(src)
return
if(my_augment)
forceMove(my_augment)
/* /*
* Human-specific mob procs. * Human-specific mob procs.
@@ -134,11 +120,10 @@
* Used to equip an organ's augment items when possible. * Used to equip an organ's augment items when possible.
* slot is the target equip slot, if it's not a generic either-hand deployable, * slot is the target equip slot, if it's not a generic either-hand deployable,
* equipping is either the target object, or a path for the target object, * equipping is either the target object, or a path for the target object,
* destroy_on_drop is the default value for the object to be deleted if it is removed from their person, if equipping is a path, however, this will be set to TRUE,
* cling_to_organ is a reference to the organ object itself, so they can easily return to their organ when removed by any means. * cling_to_organ is a reference to the organ object itself, so they can easily return to their organ when removed by any means.
*/ */
/mob/living/carbon/human/proc/equip_augment_item(var/slot, var/obj/item/equipping = null, var/make_sound = TRUE, var/destroy_on_drop = FALSE, var/obj/item/organ/cling_to_organ = null) /mob/living/carbon/human/proc/equip_augment_item(var/slot, var/obj/item/equipping = null, var/make_sound = TRUE, var/obj/item/organ/cling_to_organ = null)
if(!ishuman(src)) if(!ishuman(src))
return 0 return 0
@@ -157,8 +142,7 @@
to_chat(M,span_warning("Your hand is full. Drop something first.")) to_chat(M,span_warning("Your hand is full. Drop something first."))
return 0 return 0
var/del_if_failure = destroy_on_drop var/del_if_failure = FALSE
if(ispath(equipping)) if(ispath(equipping))
del_if_failure = TRUE del_if_failure = TRUE
equipping = new equipping(src) equipping = new equipping(src)
@@ -169,7 +153,7 @@
else else
if(slot_is_accessible(slot, equipping, src)) if(slot_is_accessible(slot, equipping, src))
equip_to_slot(equipping, slot, 1, 1) equip_to_slot(equipping, slot, 1, 1)
else if(destroy_on_drop || del_if_failure) else if(del_if_failure)
qdel(equipping) qdel(equipping)
return 0 return 0