catch dropped

This commit is contained in:
kevinz000
2020-04-22 10:54:42 -07:00
parent 3626cc5d28
commit c551006295
6 changed files with 11 additions and 2 deletions
+2
View File
@@ -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)
+3
View File
@@ -0,0 +1,3 @@
// obj/item/dropped
/// dropped() relocated this item, return FALSE for doUnEquip.
#define ITEM_RELOCATED_BY_DROPPED "relocated_by_dropped"
+2 -1
View File
@@ -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)
+2 -1
View File
@@ -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.
@@ -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..