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

Don't move players in craft in certain cases #597

Open
goodroach opened this issue Jun 21, 2023 · 4 comments
Open

Don't move players in craft in certain cases #597

goodroach opened this issue Jun 21, 2023 · 4 comments

Comments

@goodroach
Copy link
Contributor

goodroach commented Jun 21, 2023

Is your feature request related to a problem? Please describe.
There's currently a problem that I'm sure you're aware of where people can subcraft rotate the turret to pull people out of their ships or abuse the hitboxes in order to mess with players.

I'm not sure if there is a 100% foolproof solution but I have two solutions with different consequences and complexities.

Describe the solution you'd like
First solution: When a player is moved by a craft, check if that player is standing on a non-air block in the craft's hitbox. This will move the player. However, any vertical movement will result in the player being flung out of the craft.
Second solution: Have a list of blocks in the craft's hitbox with some air blocks including one block above the craft that would move a player if STOOD on.

Not sure of any other way, but this is possible, I think. I just need to know at what point does the craft start to move the player.

@TylerS1066 TylerS1066 moved this from New to In Discussion in Issue Triage Jun 24, 2023
@TylerS1066
Copy link
Contributor

I've wanted to improve the movement hitbox check algorithm for a while, but I don't think complicating it with directions is ideal. I think rather than just over-expanding the detection range for movement, we should check if the block the player is standing on (or is in) is in the craft's hitbox. For a quick first pass, we can eliminate down to only crafts within 5 blocks of the player, then check if the block the player is in or standing on is in the hitbox, then handle collisions by only respecting the larger of the two craft?

@goodroach
Copy link
Contributor Author

goodroach commented Jun 24, 2023

Would this be better if this algorithm was done using a listener since the craftTeleportEntity event is called from all forms of movement? That way, it can be checked in one listener, but I'm not sure if I should add that to the PlayerListener or if I should make a new listener class. The listener seems to already provide a craft, so there would be no need to check for a craft. I just need to check if the player is standing on the craft's block and then cancel the event if they are not.

@TylerS1066
Copy link
Contributor

Would this be better if this algorithm was done using a listener since the craftTeleportEntity event is called from all forms of movement?

Centralizing code and removing duplicates is always a good idea!

should add that to the PlayerListener or if I should make a new listener class

In my view PlayerListener is already too crowded with far too many features packed in, and should be split. Probably best to not tackle that yet, but instead just put your listener somewhere else.

@goodroach
Copy link
Contributor Author

Where should I put that listener then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Discussion
Development

No branches or pull requests

2 participants