Mouse drop refactor (#20256)

Refactored mousedrag procs, added signals, some safeguards, did some
cleanups around, renamed them to make a little more sense. Mostly put in
line with TG's code.
Fast clicking and releasing with a drag, depending on the grace period
and how fast it is done, can be counted as clicks, to aid in combat
scenarios where you spamclick.
This commit is contained in:
Fluffy
2024-12-26 14:26:32 +00:00
committed by GitHub
parent a904e1d435
commit df014f9bc0
108 changed files with 860 additions and 485 deletions
@@ -348,7 +348,7 @@
if(opened)
if(istype(attacking_item, /obj/item/grab))
var/obj/item/grab/G = attacking_item
MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
mouse_drop_receive(G.affecting, user) //act like they were dragged onto the closet
return 0
if(attacking_item.isscrewdriver()) // Moved here so you can only detach linked teleporters when the door is open. So you can like unscrew and bolt the locker normally in most circumstances.
if(linked_teleporter)
@@ -516,8 +516,8 @@
. = opened
/obj/structure/closet/MouseDrop_T(atom/dropping, mob/user)
var/atom/movable/O = dropping
/obj/structure/closet/mouse_drop_receive(atom/dropped, mob/user, params)
var/atom/movable/screen/O = dropped
if(istype(O, /atom/movable/screen)) //fix for HUD elements making their way into the world -Pete
return
if(O.loc == user)
@@ -14,7 +14,7 @@
if(opened)
if(istype(attacking_item, /obj/item/grab))
var/obj/item/grab/G = attacking_item
MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
mouse_drop_receive(G.affecting, user) //act like they were dragged onto the closet
return 0
if(!attacking_item.dropsafety())
return
@@ -40,7 +40,7 @@
/obj/structure/closet/secure_closet/personal/attackby(obj/item/attacking_item, mob/user)
if (opened)
if (istype(attacking_item, /obj/item/grab))
MouseDrop_T(attacking_item:affecting, user) //act like they were dragged onto the closet
mouse_drop_receive(attacking_item:affecting, user) //act like they were dragged onto the closet
if(attacking_item)
user.drop_from_inventory(attacking_item,loc)
else
@@ -151,7 +151,7 @@
visible_message(SPAN_DANGER("[user] strikes [src] with [attacking_item]."))
check_health()
/obj/structure/closet/statue/MouseDrop_T()
/obj/structure/closet/statue/mouse_drop_receive(atom/dropped, mob/user, params)
return
/obj/structure/closet/statue/relaymove(mob/living/user, direction)
@@ -146,9 +146,9 @@
pixel_y = -4
//For putting on tables
/obj/structure/closet/crate/MouseDrop(atom/over_object)
if (istype(over_object, /obj/structure/table))
put_on_table(over_object, usr)
/obj/structure/closet/crate/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
if (istype(over, /obj/structure/table))
put_on_table(over, user)
return TRUE
else
return ..()