diff --git a/code/datums/elements/drag_pickup.dm b/code/datums/elements/drag_pickup.dm new file mode 100644 index 000000000000..ea4fd387db5f --- /dev/null +++ b/code/datums/elements/drag_pickup.dm @@ -0,0 +1,29 @@ +/** + * drag_pickup element; for allowing things to be picked up by dragging. + * + * Used for paper bins. + */ +/datum/element/drag_pickup + element_flags = ELEMENT_DETACH + +/datum/element/drag_pickup/Attach(datum/target) + if(!ismovable(target)) + return ELEMENT_INCOMPATIBLE + RegisterSignal(target, COMSIG_MOUSEDROP_ONTO, .proc/pick_up) + return ..() + +/datum/element/drag_pickup/Detach(datum/source, force) + UnregisterSignal(source, COMSIG_MOUSEDROP_ONTO) + return ..() + +/datum/element/drag_pickup/proc/pick_up(atom/source, atom/over, mob/user) + SIGNAL_HANDLER + var/mob/living/picker = user + if(!istype(picker) || picker.incapacitated() || !source.Adjacent(picker)) + return + + if(over == picker) + INVOKE_ASYNC(picker, /mob/.proc/put_in_hands, source) + else if(istype(over, /atom/movable/screen/inventory/hand)) + var/atom/movable/screen/inventory/hand/Selected_hand = over + picker.putItemFromInventoryInHandIfPossible(source, Selected_hand.held_index) diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index e4e09e5b8175..858a8d095259 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -19,6 +19,7 @@ /obj/item/paper_bin/Initialize(mapload) . = ..() interaction_flags_item &= ~INTERACT_ITEM_ATTACK_HAND_PICKUP + AddElement(/datum/element/drag_pickup) if(!mapload) return var/obj/item/pen/P = locate(/obj/item/pen) in src.loc @@ -55,8 +56,8 @@ add_fingerprint(M) -/obj/item/paper_bin/attack_paw(mob/user) - return attack_hand(user) +/obj/item/paper_bin/attack_paw(mob/user, list/modifiers) + return attack_hand(user, modifiers) //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/paper_bin/attack_hand(mob/user) diff --git a/lobotomy-corp13.dme b/lobotomy-corp13.dme index b7a2a530349e..adbb1f0514ea 100644 --- a/lobotomy-corp13.dme +++ b/lobotomy-corp13.dme @@ -647,6 +647,7 @@ #include "code\datums\elements\decal.dm" #include "code\datums\elements\deferred_aquarium_content.dm" #include "code\datums\elements\digitalcamo.dm" +#include "code\datums\elements\drag_pickup.dm" #include "code\datums\elements\dryable.dm" #include "code\datums\elements\earhealing.dm" #include "code\datums\elements\embed.dm"