[fixed] You can't use buttons while stunned anymore #1975
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
Description
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()
inGenericButtonCommon.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()
inKnockedCommon.as
, I added: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.