Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds logic to provide leniency for drag clicks #71082

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

LemonInTheDark
Copy link
Member

@LemonInTheDark LemonInTheDark commented Nov 5, 2022

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
/馃啈

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)
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.
@tgstation-server tgstation-server added the Feature Exposes new bugs in interesting ways label Nov 5, 2022
Copy link
Member

@san7890 san7890 left a comment

spellcheck

code/_onclick/drag_drop.dm Show resolved Hide resolved
code/_onclick/drag_drop.dm Show resolved Hide resolved
code/_onclick/drag_drop.dm Show resolved Hide resolved
@LemonInTheDark
Copy link
Member Author

LemonInTheDark commented Nov 5, 2022

I appreciate it but they're temporary vars, for testin

@LemonInTheDark LemonInTheDark added the 馃搶 Test Merge Candidate This version will not be removed by actions when the PR is updated label Nov 5, 2022
@LemonInTheDark LemonInTheDark marked this pull request as draft Nov 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2022

This pull request was test merged in 442 round(s).

Round list

sybil

@Mothblocks
Copy link
Member

Mothblocks commented Nov 22, 2022

update?

@LemonInTheDark
Copy link
Member Author

LemonInTheDark commented Nov 23, 2022

Ok so like, it works, but it's kinda hard to test if it does what I want because it's not something people really notice in play.
I might uh, play a few rounds as a janitor or something and modify it between games until it feels right to me. Not really sure how to approach this otherwise since the cases where it matters are sorta rare

@Mothblocks
Copy link
Member

Mothblocks commented Nov 23, 2022

Log when it happens and see idk

@LemonInTheDark
Copy link
Member Author

LemonInTheDark commented Nov 23, 2022

Log when it happens and see idk

didn't even consider it, thanks bestie

Also fixes a bug in monkey behaviors, ninja used the WRONG proc, was
trying to use an arm as a slot
@github-actions github-actions bot requested a review from tralezab Nov 23, 2022
If you click on a turf and drag to a non turf within the window
we assume you meant to click on the non turf, and just missed
@SkeletalElite
Copy link
Contributor

SkeletalElite commented Nov 24, 2022

I pretty frequently accidentally kick/punch someone when trying to fireman carry or strip when this is test merged, is a little annoying.

@LemonInTheDark
Copy link
Member Author

LemonInTheDark commented Nov 24, 2022

Should add a case for landing on a mob, since that's a lot of cases. I didn't think people dragged quickly enough for it to be a problem
Wonder if I'll have problems with shuttle seats

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Exposes new bugs in interesting ways 馃搶 Test Merge Candidate This version will not be removed by actions when the PR is updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants