pub(crate) struct ClientAuthoredMovementState {
last_good_position: DVec3,
first_good_position: DVec3,
received_move_packet_count: i32,
known_move_packet_count: i32,
last_known_client_movement: DVec3,
client_is_floating: bool,
above_ground_tick_count: i32,
}Expand description
State shared by vanilla client-authored movement validation.
Vanilla stores parallel copies of this state in ServerGamePacketListenerImpl
for the player body and for the controlled root vehicle. Steel keeps it as a
reusable value so vehicle movement can use the same bookkeeping instead of
growing a second player-local copy.
Fields§
§last_good_position: DVec3Last known good position for collision rollback.
first_good_position: DVec3Position at the start of the tick for speed validation.
received_move_packet_count: i32Number of move packets received since connection start.
known_move_packet_count: i32Number of move packets at the last tick.
last_known_client_movement: DVec3Last movement accepted from the client.
client_is_floating: boolWhether the last accepted client move appeared unsupported in air.
above_ground_tick_count: i32Number of consecutive ticks the client has appeared unsupported in air.
Implementations§
Source§impl ClientAuthoredMovementState
impl ClientAuthoredMovementState
Sourcepub(crate) const fn reset_for_tick(&mut self, position: DVec3)
pub(crate) const fn reset_for_tick(&mut self, position: DVec3)
Resets per-tick vanilla movement validation bases.
Sourcepub(crate) const fn reset_for_position_sync(&mut self, position: DVec3)
pub(crate) const fn reset_for_position_sync(&mut self, position: DVec3)
Resets validation bases after a server position sync.
Sourcepub(crate) const fn good_positions(&self) -> (DVec3, DVec3)
pub(crate) const fn good_positions(&self) -> (DVec3, DVec3)
Returns the current vanilla first-good and last-good validation positions.
Sourcepub(crate) const fn record_move_packet_delta(&mut self) -> i32
pub(crate) const fn record_move_packet_delta(&mut self) -> i32
Records a received movement packet and returns packets since the last tick.
Sourcepub(crate) const fn mark_last_good_position(&mut self, position: DVec3)
pub(crate) const fn mark_last_good_position(&mut self, position: DVec3)
Marks a movement target as the latest accepted vanilla last-good position.
Sourcepub(crate) const fn set_last_known_client_movement(&mut self, movement: DVec3)
pub(crate) const fn set_last_known_client_movement(&mut self, movement: DVec3)
Sets the last accepted client movement vector.
Sourcepub(crate) const fn reset_last_known_client_movement(&mut self)
pub(crate) const fn reset_last_known_client_movement(&mut self)
Clears the last accepted client movement vector.
Sourcepub(crate) const fn last_known_client_movement(&self) -> DVec3
pub(crate) const fn last_known_client_movement(&self) -> DVec3
Returns the last accepted client movement vector.
Sourcepub(crate) const fn record_client_floating(&mut self, client_is_floating: bool)
pub(crate) const fn record_client_floating(&mut self, client_is_floating: bool)
Records whether the latest accepted movement made the client appear to float.
Sourcepub(crate) const fn clear_client_floating(&mut self)
pub(crate) const fn clear_client_floating(&mut self)
Clears vanilla floating violation state.
Sourcepub(crate) const fn reset_flying_ticks(&mut self)
pub(crate) const fn reset_flying_ticks(&mut self)
Resets the vanilla floating violation counter.
Sourcepub(crate) const fn tick_client_floating(
&mut self,
should_count: bool,
maximum_flying_ticks: i32,
) -> bool
pub(crate) const fn tick_client_floating( &mut self, should_count: bool, maximum_flying_ticks: i32, ) -> bool
Advances the vanilla floating violation tracker.
Returns true once the client has exceeded the configured maximum flying ticks.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientAuthoredMovementState
impl RefUnwindSafe for ClientAuthoredMovementState
impl Send for ClientAuthoredMovementState
impl Sync for ClientAuthoredMovementState
impl Unpin for ClientAuthoredMovementState
impl UnsafeUnpin for ClientAuthoredMovementState
impl UnwindSafe for ClientAuthoredMovementState
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<>>