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
+4
View File
@@ -85,3 +85,7 @@
var/list/spell_tabs = list()
///Our object window datum. It stores info about and handles behavior for the object tab
var/datum/object_window_info/obj_window
///When we started the currently active drag
var/drag_start = 0
///The params we were passed at the start of the drag, in list form
var/list/drag_details
+20 -1
View File
@@ -814,6 +814,12 @@ var/list/localhost_addresses = list(
CRASH("Age check regex failed for [src.ckey]")
/client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)
var/list/modifiers = params2list(params)
if(!drag_start) // If we're just starting to drag
drag_start = world.time
drag_details = modifiers.Copy()
. = ..()
if(over_object)
@@ -831,7 +837,18 @@ var/list/localhost_addresses = list(
CHECK_TICK
/client/MouseDown(object, location, control, params)
/client/MouseDrop(atom/src_object, atom/over_object, atom/src_location, atom/over_location, src_control, over_control, params)
SHOULD_NOT_OVERRIDE(TRUE)
..()
drag_start = 0
drag_details = null
/client/MouseDown(datum/object, location, control, params)
if(QDELETED(object)) //Yep, you can click on qdeleted things before they have time to nullspace. Fun.
return
SEND_SIGNAL(src, COMSIG_CLIENT_MOUSEDOWN, object, location, control, params)
var/obj/item/I = mob.get_active_hand()
var/obj/O = object
if(istype(I, /obj/item/gun) && !mob.in_throw_mode)
@@ -893,6 +910,8 @@ var/list/localhost_addresses = list(
sleep(G.fire_delay)
/client/MouseUp(object, location, control, params)
if(SEND_SIGNAL(src, COMSIG_CLIENT_MOUSEUP, object, location, control, params) & COMPONENT_CLIENT_MOUSEUP_INTERCEPT)
src = src //This doesn't do shit, when you implement click interception change this
autofire_aiming_at[1] = null
/atom/proc/is_auto_clickable()