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

Force location queries to check center of block #1000

Merged
merged 1 commit into from
May 13, 2022

Conversation

Pugzy
Copy link
Contributor

@Pugzy Pugzy commented Apr 24, 2022

This makes a LocationQuery use the center of a block when checking if the player is inside a region. Region checks use the PlayerCoarseMoveEvent which happens when a player enters or leaves a whole block, when combined with a contains check using the player's actual coordinates results in counting them as being in a region below them when they're not.

This was noticed when shifting/standing above a scorebox/portal that shared the same region. Take the below example:

<cuboid id="blue-scorebox" min="1825,7,-1361" max="1828,9,-1364"/>

If a player was stood on top of the block at the max of this region (y = 9.0 exactly) then the portal's contains check matches but the scoreboxes enters check does not. Portals (dynamic)(and other region contains LocationQuery checks) are currently using the players location to detect if they are in the region which triggers the portal when they're not inside the region causing them to be prematurely teleport and not receive points.

This can be seen here: https://discord.com/channels/86514356862320640/172382420954251264/962731072234328214

Whilst tinkering with the above checking through the stack of events and methods the below changes were also identified.

- Replace the usage of PlayerQuery (without location) in the RegionMatchModule with the player itself as the player is already a query (due to the dynamic changes). This allows the PlayerQuery to be changed to be a PlayerWithLocationQuery used only for checking locations that are not the player's current location (only used in flag drop locations atm).

- The above change also means that the event is passed with the rfa check and query as it is no longer contained in the PlayerQuery wrapper (so needs to be passed so it can be cancelled if needed).

  • Removes a duplicate call to get the PGM player inside the FilterMatchModule.

Signed-off-by: Pugzy [email protected]

@Pugzy Pugzy requested a review from Electroid as a code owner April 24, 2022 16:26
@Pugzy Pugzy force-pushed the center-block-check branch from 51a961d to 69a914d Compare April 24, 2022 16:31
Copy link
Member

@Pablete1234 Pablete1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the block center changes, undo the player query changes. The event is needed in the filters

@Pugzy Pugzy force-pushed the center-block-check branch from c09226a to 2418728 Compare May 11, 2022 16:25
@Pablete1234 Pablete1234 added the ready PR is ready to merge label May 12, 2022
@Electroid Electroid merged commit f40b2a5 into PGMDev:dev May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR is ready to merge
Development

Successfully merging this pull request may close these issues.

3 participants