[MIRROR] Adds logic to provide leniency for drag clicks [MDB IGNORE] (#18124)

* Adds logic to provide leniency for drag clicks (#71082)

## About The Pull Request

Ok so like, in byond. if you click on something and release the click
without moving off its sprite, that counts as a "click"

If you however move your mouse off its sprite, or it does so on its own,
any further releases count as dragdrops.

We already have logic for catching drag -> mouse back over sprite. The
code I'm adding here basically is just a bit nicer about how exact you
need to be

I'm adding tweakable values for how much your mouse is allowed to move
(This isn't perfect currently, since if the target itself moves we don't
care, need to work on this) in a short time period. If you meet these
cases, we instead call it a click.

They're globs for now cause I don't have a good feel for em, will tweak
over time. I want to reduce dumb clickspam and click dragging moving
mobs/drifting items by accident.

Oh also fixed a bug in ai behaviors that came from not knowing what
get_active_hand did

Fixes a monkey behavior of using their held item

It turns out it never worked, and the only reason it didn't runtime was
because of an if() check that got passed the result of an invalid proc
call. this fixes that

## Why It's Good For The Game

Spam clicking and drag clicking are stupid. they should be less stupid

## Changelog
🆑
add: Adds a grace period for hit detection, between clicking ON someone,
and then moving your mouse off before releasing the click. It's short,
hopefully it helps with stupid
/🆑

* Adds logic to provide leniency for drag clicks

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-12-13 20:59:30 -08:00
committed by GitHub
co-authored by LemonInTheDark
parent fbc214d26a
commit 6a5b4a4bac
5 changed files with 78 additions and 6 deletions
+4
View File
@@ -172,6 +172,10 @@
var/middragtime = 0
//Middle-mouse-button clicked object control for aimbot exploit detection. Weakref
var/datum/weakref/middle_drag_atom_ref
//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
/// Messages currently seen by this client