pub struct MovementState {
client_movement: ClientAuthoredMovementState,
client_vehicle_movement: ClientAuthoredMovementState,
received_movement_this_tick: bool,
client_vehicle_id: Option<i32>,
last_client_input: PlayerInput,
}Expand description
Internal movement tracking state, stored behind a single SyncMutex on Player.
Fields§
§client_movement: ClientAuthoredMovementStateVanilla validation state for client-authored body movement.
client_vehicle_movement: ClientAuthoredMovementStateVanilla validation state for the controlled root vehicle.
received_movement_this_tick: boolWhether vanilla accepted player-authored movement during the current client tick.
client_vehicle_id: Option<i32>Entity id of the controlled root vehicle tracked this tick.
last_client_input: PlayerInputLatest vanilla client input snapshot sent by the player.
Implementations§
Source§impl MovementState
impl MovementState
pub const fn new() -> Self
Sourcepub(in player) const fn set_last_client_input(
&mut self,
input: PlayerInput,
)
pub(in player) const fn set_last_client_input( &mut self, input: PlayerInput, )
Stores the latest client input snapshot.
Sourcepub(in player) const fn last_client_input(
&self,
) -> PlayerInput
pub(in player) const fn last_client_input( &self, ) -> PlayerInput
Returns the latest client input snapshot.
Sourcepub(in player) const fn reset_for_tick(
&mut self,
position: DVec3,
)
pub(in player) const fn reset_for_tick( &mut self, position: DVec3, )
Resets per-tick vanilla movement validation bases.
Sourcepub(in player) const fn reset_vehicle_for_tick(
&mut self,
vehicle_id: i32,
position: DVec3,
)
pub(in player) const fn reset_vehicle_for_tick( &mut self, vehicle_id: i32, position: DVec3, )
Resets per-tick vanilla controlled-vehicle movement validation bases.
Sourcepub(in player) const fn clear_vehicle_for_tick(
&mut self,
)
pub(in player) const fn clear_vehicle_for_tick( &mut self, )
Clears the active controlled-vehicle validation state for this tick.
Sourcepub(in player) const fn vehicle_good_positions(
&self,
vehicle_id: i32,
) -> Option<(DVec3, DVec3)>
pub(in player) const fn vehicle_good_positions( &self, vehicle_id: i32, ) -> Option<(DVec3, DVec3)>
Returns the current vanilla controlled-vehicle validation positions.
Sourcepub(in player) const fn reset_for_position_sync(
&mut self,
position: DVec3,
)
pub(in player) const fn reset_for_position_sync( &mut self, position: DVec3, )
Resets movement validation bases after a server position sync.
Sourcepub(in player) const fn good_positions(
&self,
) -> (DVec3, DVec3)
pub(in player) const fn good_positions( &self, ) -> (DVec3, DVec3)
Returns the current vanilla first-good and last-good validation positions.
Sourcepub(in player) const fn record_move_packet_delta(
&mut self,
) -> i32
pub(in player) const fn record_move_packet_delta( &mut self, ) -> i32
Records a received movement packet and returns packets since the last tick.
Sourcepub(in player) const fn mark_last_good_position(
&mut self,
position: DVec3,
)
pub(in player) const fn mark_last_good_position( &mut self, position: DVec3, )
Marks a movement target as the latest accepted vanilla last-good position.
Sourcepub(in player) const fn mark_vehicle_last_good_position(
&mut self,
vehicle_id: i32,
position: DVec3,
)
pub(in player) const fn mark_vehicle_last_good_position( &mut self, vehicle_id: i32, position: DVec3, )
Marks a controlled-vehicle target as the latest accepted vanilla last-good position.
Sourcepub(in player) const fn set_last_known_client_movement(
&mut self,
movement: DVec3,
)
pub(in player) const fn set_last_known_client_movement( &mut self, movement: DVec3, )
Sets the last accepted client movement vector.
Sourcepub(in player) const fn reset_last_known_client_movement(
&mut self,
)
pub(in player) const fn reset_last_known_client_movement( &mut self, )
Clears the last accepted client movement vector.
Sourcepub(in player) const fn finish_client_tick(
&mut self,
)
pub(in player) const fn finish_client_tick( &mut self, )
Applies vanilla client-tick-end known-movement handling.
Sourcepub(in player) const fn last_known_client_movement(
&self,
) -> DVec3
pub(in player) const fn last_known_client_movement( &self, ) -> DVec3
Returns the last accepted client movement vector.
Sourcepub(in player) const fn record_client_floating(
&mut self,
client_is_floating: bool,
)
pub(in player) const fn record_client_floating( &mut self, client_is_floating: bool, )
Records whether the latest accepted movement made the client appear to float.
Sourcepub(in player) const fn record_vehicle_client_floating(
&mut self,
vehicle_id: i32,
client_is_floating: bool,
)
pub(in player) const fn record_vehicle_client_floating( &mut self, vehicle_id: i32, client_is_floating: bool, )
Records whether the controlled vehicle appeared to float after accepted movement.
Sourcepub(in player) const fn reset_flying_ticks(
&mut self,
)
pub(in player) const fn reset_flying_ticks( &mut self, )
Resets the vanilla floating violation counter.
Auto Trait Implementations§
impl Freeze for MovementState
impl RefUnwindSafe for MovementState
impl Send for MovementState
impl Sync for MovementState
impl Unpin for MovementState
impl UnsafeUnpin for MovementState
impl UnwindSafe for MovementState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>