Reworked Vehicle PlayerMoveEvent Handling #11835
Open
+52
−86
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.
Reworked Vehicle PlayerMoveEvent Handling
The
PlayerMoveEvent
is triggered whenever a player controls a vehicle.This event is generally broken, and does not represent what is actually happen. For example, the event used the player's location as the "from" position and the vehicle's location as the "to" position. This caused significant issues and confusion:
setTo
calls effectively useless.Fixes:
#8214
#7021
In order to best clean up the event logic, the solution is to center the event around the vehicle rather than the player.
Key Changes
Player Remains Untouched
PlayerMoveEvent
when they are riding a vehicle.Vehicle Based Event
getFrom()
andgetTo()
now return the vehicle’s position, making the event specifically about the vehicle’s motion.event.setTo()
, it teleports the vehicle, rather than trying to teleport the player. This allows movement to be pretty fluid.Improved Cancellation Logic
Player Desync
Summary of the New Behavior
Feedback Point:
Maybe make a new event entirely? As there is no PlayerMoveEvent called when a vehicle moves a player that isnt controlled by a player. It seems weird for us to continue supporting this event call.
8mb.video-Ear-qyB5Bf5T.mp4