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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fixed] You can't use buttons while stunned anymore #1975

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Mar 25, 2024

Status

  • READY: this PR is (to the best of your knowledge) ready to be incorporated into the game.

Description

[fixed] that you could show "key_use" buttons while stunned
[fixed] that you could keep showing buttons, get stunned and then use them

Fixes #1951
Fixes #1028

I first noticed this problem in TDM. I was stunned due to falling from a height but was still able to open a chest without delay. This shouldn't be possible, so...

Preventing the player from showing new buttons

This PR adds a check to canSeeButtons() in GenericButtonCommon.as to see if the player is stunned (= knocked).
If the player is stunned, he won't be able to show any blob buttons by using "key_use".
Luckily this seems to work for inventory buttons, too. As far as I understand they are server-handled.
I wasn't able to access inventories after applying this fix.

Removing already existing buttons

Inside DoKnockedUpdate() in KnockedCommon.as, I added:

if (this.isMyPlayer())
{
	this.ClearButtons();
	this.ClearMenus();
}

This causes buttons that already existed due to keeping "key_use" pressed to exit while the player is stunned.

Now the player can't manage inventories, change class or use tunnels while stunned anymore.

Tested in offline and online, works as intended.

Steps to Test or Reproduce

Be a knight, /coins 999, spawn a knightshop and buy a bunch of waterbombs.
Go to a chest, tent, storage or tunnel (when there are at least 2).
Throw a waterbomb above you.
Try to press or keep pressed the key_use key in order to show or keep showing buttons for above mentioned blobs, before or after getting hit by the waterbomb.
Notice you will be able to show and use buttons while stunned.
After this PR, you won't be able to.

@mugg91
Copy link
Contributor Author

mugg91 commented Apr 1, 2024

I noticed this old issue #1028

This PR already fixes the issue but the inventory screen would open for 1 tick with each key_inventory press while stunned.
I added a commit that will make it so it doesn't open at all during stun.

Fixes the above-mentioned issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stunned players still get to perform some actions related to buttons Fix eating while stunned
1 participant