Fix modsuits and defibs (#93373)

## About The Pull Request

Fixes #93359

Caused by #93165

Inventory screen elements were no longer considered reachable, which
broke mousedrop handing on objects that check "is dragging into
inventory slot"

I don't know the best way to fix this yet but I figured the next best
thing would be to make all of these use the `drag_pickup` element, which
skips this reach-ability check

Thus I refactored it slightly to accommodate for items which should
contextually not be drag-pick-up-abble and bam, works like a charm

## Changelog

🆑 Melbert
fix: Dragging defibs and modsuits off your back works again
/🆑

---------

Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: Xander3359 <66163761+Xander3359@users.noreply.github.com>
This commit is contained in:
MrMelbert
2025-10-11 17:17:23 -05:00
committed by GitHub
parent 4bdce87fee
commit da10322dc1
16 changed files with 73 additions and 130 deletions
+16 -13
View File
@@ -1,7 +1,8 @@
/**
* drag_pickup element; for allowing things to be picked up by dragging.
* drag_pickup element
*
* Used for paper bins.
* Allowing things to be picked up or unequipped by mouse-dragging.
* Useful for objects which have an interaction on click
*/
/datum/element/drag_pickup
@@ -15,20 +16,22 @@
UnregisterSignal(source, COMSIG_MOUSEDROP_ONTO)
return ..()
/datum/element/drag_pickup/proc/pick_up(atom/source, atom/over, mob/user)
/datum/element/drag_pickup/proc/pick_up(atom/movable/source, atom/over, mob/user)
SIGNAL_HANDLER
var/mob/living/picker = user
if(!istype(picker) || !user.can_perform_action(source, FORBID_TELEKINESIS_REACH))
return
var/obj/pickup_object = source
if (pickup_object)
if (pickup_object.anchored)
if(!user.can_perform_action(source, FORBID_TELEKINESIS_REACH))
return NONE
if(source.anchored)
return NONE
if(source.loc == user && isitem(source))
var/obj/item/item_source = source
if(!item_source.can_mob_unequip(user))
return COMPONENT_CANCEL_MOUSEDROP_ONTO
if(over == picker)
INVOKE_ASYNC(picker, TYPE_PROC_REF(/mob/, put_in_hands), source)
if(over == user)
INVOKE_ASYNC(user, TYPE_PROC_REF(/mob, 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)
var/atom/movable/screen/inventory/hand/selected_hand = over
user.putItemFromInventoryInHandIfPossible(source, selected_hand.held_index)
source.add_fingerprint(user)
return COMPONENT_CANCEL_MOUSEDROP_ONTO