From c551006295ad162a3d86367ede238faccb972fc9 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Wed, 22 Apr 2020 10:54:42 -0700 Subject: [PATCH] catch dropped --- code/__DEFINES/dcs/signals.dm | 2 ++ code/__DEFINES/misc/return_values.dm | 3 +++ code/game/objects/items.dm | 3 ++- code/modules/mob/inventory.dm | 3 ++- code/modules/surgery/organs/augments_arms.dm | 1 + tgstation.dme | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 code/__DEFINES/misc/return_values.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index b32625a539..9d7c33f8a7 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -241,6 +241,8 @@ #define COMSIG_ITEM_ALT_AFTERATTACK "item_alt_afterattack" //from base of obj/item/altafterattack(): (atom/target, mob/user, proximity, params) #define COMSIG_ITEM_EQUIPPED "item_equip" //from base of obj/item/equipped(): (/mob/equipper, slot) #define COMSIG_ITEM_DROPPED "item_drop" //from base of obj/item/dropped(): (mob/user) + // relocated, tell inventory procs if those called this that the item isn't available anymore. + #define COMPONENT_DROPPED_RELOCATION 1 #define COMSIG_ITEM_PICKUP "item_pickup" //from base of obj/item/pickup(): (/mob/taker) #define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone" //from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone) #define COMSIG_ITEM_IMBUE_SOUL "item_imbue_soul" //return a truthy value to prevent ensouling, checked in /obj/effect/proc_holder/spell/targeted/lichdom/cast(): (mob/user) diff --git a/code/__DEFINES/misc/return_values.dm b/code/__DEFINES/misc/return_values.dm new file mode 100644 index 0000000000..d55f603de9 --- /dev/null +++ b/code/__DEFINES/misc/return_values.dm @@ -0,0 +1,3 @@ +// obj/item/dropped +/// dropped() relocated this item, return FALSE for doUnEquip. +#define ITEM_RELOCATED_BY_DROPPED "relocated_by_dropped" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5c80b81ba5..9455a610c5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -392,7 +392,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if(item_flags & DROPDEL) qdel(src) item_flags &= ~IN_INVENTORY - SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user) + if(SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user) & COMPONENT_DROPPED_RELOCATION) + return ITEM_RELOCATED_BY_DROPPED user.update_equipment_speed_mods() // called just as an item is picked up (loc is not yet changed) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 9f7d2067de..fad3a7e534 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -333,7 +333,8 @@ I.moveToNullspace() else I.forceMove(newloc) - I.dropped(src) + if(I.dropped(src) == ITEM_RELOCATED_BY_DROPPED) + return FALSE return TRUE //Outdated but still in use apparently. This should at least be a human proc. diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index bdd7da9d5a..cc3928e6ac 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -33,6 +33,7 @@ RegisterSignal(I, COMSIG_ITEM_DROPPED, .proc/magnetic_catch) /obj/item/organ/cyberimp/arm/proc/magnetic_catch(datum/source, mob/user) + . = COMPONENT_DROPPED_RELOCATION var/obj/item/I = source //if someone is misusing the signal, just runtime if(I in items_list) if(I in contents) //already in us somehow? i probably shouldn't catch this so it's easier to spot bugs but eh.. diff --git a/tgstation.dme b/tgstation.dme index 41708bc0bd..1ec3728280 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -124,6 +124,7 @@ #include "code\__DEFINES\dcs\helpers.dm" #include "code\__DEFINES\dcs\signals.dm" #include "code\__DEFINES\flags\shields.dm" +#include "code\__DEFINES\misc\return_values.dm" #include "code\__HELPERS\_cit_helpers.dm" #include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm"