Increase shield activation speed #3993

Closed
Eliy21 wants to merge 2 commits from (deleted):faster_shielding into master
Contributor

Increase the responsiveness of shields.

Testing

-In creative get 2 shields and hold right click while shield is in hotbar to see if it activates faster
-Place a shield in the inventory shield slot and hold right click to test if the results are the same
-Get some weapons (e.g. sword) while the shield is in offhand and right click to see if they work
-Get some mob eggs and summon them and test if your shield still protects you from danger (test both offhand and hotbar shielding)

EDIT:
-Also test multiple times (10 or 100 or more) while shield is in hotbar hold right-click the crafting table and the enchanting table and see if the shield HUD gets stuck and blocks the menu preventing you from using these tables.

<!-- Please follow our contributing guidelines first: https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CONTRIBUTING.md#how-you-can-help-as-a-programmer By submitting this pull request, you agree to follow our Code of Conduct: https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CODE_OF_CONDUCT.md --> Increase the responsiveness of shields. ### Testing -In creative get 2 shields and hold right click while shield is in hotbar to see if it activates faster -Place a shield in the inventory shield slot and hold right click to test if the results are the same -Get some weapons (e.g. sword) while the shield is in offhand and right click to see if they work -Get some mob eggs and summon them and test if your shield still protects you from danger (test both offhand and hotbar shielding) EDIT: -Also test multiple times (10 or 100 or more) while shield is in hotbar hold right-click the crafting table and the enchanting table and see if the shield HUD gets stuck and blocks the menu preventing you from using these tables.
Eliy21 force-pushed faster_shielding from 4a2341f26c to ada1e1e0ff 2023-11-03 16:20:38 +01:00 Compare
ancientmarinerdev requested changes 2023-11-03 17:07:32 +01:00
ancientmarinerdev left a comment
Owner

Nice piece of investigation and I appreciate the PR.

However, I would probably be against this change right now until we have a resolution for: #2756

Basically shield comes up when you use the crafting table in common play. It is infuriating because it isn't obvious why it happens and took a while for us to figure it out. This would make this happen statistically more. Without a way to cancel blocking when interacting with crafting table and all other blocks with an interface, I would be reluctant for this to go in as it would probably make player experience worse for most.

Nice piece of investigation and I appreciate the PR. However, I would probably be against this change right now until we have a resolution for: #2756 Basically shield comes up when you use the crafting table in common play. It is infuriating because it isn't obvious why it happens and took a while for us to figure it out. This would make this happen statistically more. Without a way to cancel blocking when interacting with crafting table and all other blocks with an interface, I would be reluctant for this to go in as it would probably make player experience worse for most.
Author
Contributor

@ancientmarinerdev I can't seem to reproduce that bug. Can you give me a step by step? Since with this PR, the shield also deactivates quickly so it might even reduce the likelihood of blocking the crafting table? I'm testing it right now but can't reproduce it.

@ancientmarinerdev I can't seem to reproduce that bug. Can you give me a step by step? Since with this PR, the shield also deactivates quickly so it might even reduce the likelihood of blocking the crafting table? I'm testing it right now but can't reproduce it.
Author
Contributor

@ancientmarinerdev The shield seems to not activate when near and at the same time pointing to a node on rightclick so the proper right clicking action happens. If it's not a bother, can you see if you can reproduce that bug using this branch?

@ancientmarinerdev The shield seems to not activate when near and at the same time pointing to a node on rightclick so the proper right clicking action happens. If it's not a bother, can you see if you can reproduce that bug using this branch?
Author
Contributor

Okay for some reason I can now right click while pointing to a near node so I can shield while right clicking the crafting table but the shield automatically disappears when the menu appears so the bug didn't happen.

Okay for some reason I can now right click while pointing to a near node so I can shield while right clicking the crafting table but the shield automatically disappears when the menu appears so the bug didn't happen.

Okay for some reason I can now right click while pointing to a near node so I can shield while right clicking the crafting table but the shield automatically disappears when the menu appears so the bug didn't happen.

Not on your machine right now. It isn't common, but it's happened to me 8 or 9 times, and for other users also including multiplayer.

It isn't all the time, but does happen enough to be baffling and frustratiing.

> Okay for some reason I can now right click while pointing to a near node so I can shield while right clicking the crafting table but the shield automatically disappears when the menu appears so the bug didn't happen. Not on your machine right now. It isn't common, but it's happened to me 8 or 9 times, and for other users also including multiplayer. It isn't all the time, but does happen enough to be baffling and frustratiing.
Author
Contributor

If I know what causes it I might see if I can fix it but since the cause seems vague I don't know if I can.

Not on your machine right now. It isn't common, but it's happened to me 8 or 9 times, and for other users also including multiplayer.

If my machine can't reproduce the bug then can you reproduce it on this PR branch?

If I know what causes it I might see if I can fix it but since the cause seems vague I don't know if I can. > Not on your machine right now. It isn't common, but it's happened to me 8 or 9 times, and for other users also including multiplayer. If my machine can't reproduce the bug then can you reproduce it on this PR branch?
Eliy21 added 1 commit 2023-11-03 19:13:16 +01:00
Author
Contributor

@ancientmarinerdev I've implemented some additional shield HUD removal line that will hopefully increase the chances of the HUD being purged in case those bug causes were due to globalstep not making it in time and having a gap in closing the HUD before the menu GUI pops out. This also might explain why some machines do or do not encounter this problem often as having a difference resources might make the globalstep less prone to missing those HUD clearing timings.

@ancientmarinerdev I've implemented some additional shield HUD removal line that will hopefully increase the chances of the HUD being purged in case those bug causes were due to globalstep not making it in time and having a gap in closing the HUD before the menu GUI pops out. This also might explain why some machines do or do not encounter this problem often as having a difference resources might make the globalstep less prone to missing those HUD clearing timings.
Eliy21 requested review from ancientmarinerdev 2023-11-03 19:42:58 +01:00
Member

I've also had this bug happen. And, I am running a pretty decent machine.

A thought for it would be, clear the HUD before interacting with any formspec. As, it can occur on any of them (like the crafting table, inventory, etc.)

I've also had this bug happen. And, I am running a pretty decent machine. A thought for it would be, clear the HUD before interacting with any formspec. As, it can occur on any of them (like the crafting table, inventory, etc.)

Rejected. This aggravates the bug mentioned (and no, fe139554cb doesn't fix it, not sure how the bug even happens exactly), isn't that important, and doesn't touch the other ton of issues that we have with shields. One thing this does is making the bug way easier to reproduce, so thank you for that.

The shields' code is a mess, and needs a thorough review, if not rewriting from scratch. I'm currently looking through it to see its state.

Rejected. This aggravates the bug mentioned (and no, fe139554cb doesn't fix it, not sure how the bug even happens exactly), isn't that important, and doesn't touch the other ton of issues that we have with shields. One thing this does is making the bug way easier to reproduce, so thank you for that. The shields' code is a mess, and needs a thorough review, if not rewriting from scratch. I'm currently looking through it to see its state.
the-real-herowl closed this pull request 2023-11-03 23:03:51 +01:00
Member

It needs a serious rewrite. As I have mentioned before, the shield code is a hack because minetest removed the offhand use of items.

It needs a serious rewrite. As I have mentioned before, the shield code is a hack because minetest removed the offhand use of items.
Author
Contributor

It was a shot in the dark trying to fix a bug that I can't see/reproduce. I was going to have a go at it again but if the code is planned to be rewritten then I guess I'll leave it for now.

It was a shot in the dark trying to fix a bug that I can't see/reproduce. I was going to have a go at it again but if the code is planned to be rewritten then I guess I'll leave it for now.

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#3993
No description provided.