Fix PIE not being cancelled after a cancelled PIEE#8435
Open
sovdeeth wants to merge 3 commits intoSkriptLang:dev/patchfrom
Open
Fix PIE not being cancelled after a cancelled PIEE#8435sovdeeth wants to merge 3 commits intoSkriptLang:dev/patchfrom
sovdeeth wants to merge 3 commits intoSkriptLang:dev/patchfrom
Conversation
…gated to the following PlayerInteractEvent
1 task
Contributor
|
excellent investigation :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When a user clicks on an entity with a wind charge, for instance, a PlayerInteractEntityEvent is called. Skript uses this to trigger EvtClick, and can properly cancel it. However, then a PlayerInteractEvent is called, Skript skips it to avoid duplicating click events, and doesn't properly forward the cancellation from the prior PIEE.
When determining whether a received PIE should be treated as cancelled, Skript would treat any DENY as a cancellation, except if the click is on AIR and the useItemInHand is NOT DENY. This didn't handle cases like RIGHT_CLICK_BLOCK + DENY useInteractedBlock + DEFAULT useItemInHand. Skript would assume it is cancelled, not handle it, and then the user would shoot a wind charge.
Solution
Forwards the cancellation from PIEE to PIE, and properly tracks PIEE cancellations.
Determines cancellation properly for all PIE combinations. RIGHT_CLICK_BLOCK is complex and not possible to always determine, so I erred on the side of caution and treated it as cancelled ONLY if both uses are DENY. This means a hoe-ing of dirt that was denied solely on one or the other will be treated as uncancelled, despite it clearly being cancelled. There's no good way to solve this without introducing specific syntax to cancel item use or block use (which I will make a feature pr for), but I think this is acceptable for a bug fix.
Testing Completed
Manual confirmation.
Supporting Information
Completes: #8434
Related: none
AI assistance: none