pub(crate) struct PlayerTicketTracker {
players_by_pos: FxHashMap<ChunkPos, FxHashSet<Uuid>>,
player_positions: FxHashMap<Uuid, ChunkPos>,
loading_coverage: FxHashMap<ChunkPos, usize>,
view_distance: u8,
simulation_distance: u8,
}Expand description
Owns player positions and the logical coverage of Vanilla’s player tickets.
Steel materializes the coverage immediately; generation admission remains bounded by its generation scheduler instead of Vanilla’s ticket dispatcher.
The caller holds this tracker and ChunkTicketStorage under the same
ingress lock, so one method call is the atomic player-source mutation.
Fields§
§players_by_pos: FxHashMap<ChunkPos, FxHashSet<Uuid>>§player_positions: FxHashMap<Uuid, ChunkPos>§loading_coverage: FxHashMap<ChunkPos, usize>§view_distance: u8§simulation_distance: u8Implementations§
Source§impl PlayerTicketTracker
impl PlayerTicketTracker
Sourcepub(crate) fn new(view_distance: u8, simulation_distance: u8) -> Self
pub(crate) fn new(view_distance: u8, simulation_distance: u8) -> Self
Creates an empty tracker with the current global player distances.
Sourcepub(crate) fn add_player(
&mut self,
storage: &mut ChunkTicketStorage,
pos: ChunkPos,
player_id: Uuid,
) -> SourceProjectionChanges
pub(crate) fn add_player( &mut self, storage: &mut ChunkTicketStorage, pos: ChunkPos, player_id: Uuid, ) -> SourceProjectionChanges
Adds a player, moving an existing UUID from its previous position.
Sourcepub(crate) fn remove_player(
&mut self,
storage: &mut ChunkTicketStorage,
pos: ChunkPos,
player_id: Uuid,
) -> SourceProjectionChanges
pub(crate) fn remove_player( &mut self, storage: &mut ChunkTicketStorage, pos: ChunkPos, player_id: Uuid, ) -> SourceProjectionChanges
Removes a player only when the UUID still maps to the supplied position.
Sourcepub(crate) fn set_simulation_distance(
&mut self,
storage: &mut ChunkTicketStorage,
simulation_distance: u8,
) -> SourceProjectionChanges
pub(crate) fn set_simulation_distance( &mut self, storage: &mut ChunkTicketStorage, simulation_distance: u8, ) -> SourceProjectionChanges
Replaces the simulation ticket at every occupied player center.
Sourcepub(crate) fn set_view_distance(
&mut self,
storage: &mut ChunkTicketStorage,
view_distance: u8,
) -> SourceProjectionChanges
pub(crate) fn set_view_distance( &mut self, storage: &mut ChunkTicketStorage, view_distance: u8, ) -> SourceProjectionChanges
Updates loading coverage for a changed global view distance.
fn remove_player_from_center( &mut self, storage: &mut ChunkTicketStorage, pos: ChunkPos, player_id: Uuid, changes: &mut SourceProjectionChanges, )
fn increment_loading_coverage( &mut self, storage: &mut ChunkTicketStorage, pos: ChunkPos, changes: &mut SourceProjectionChanges, )
fn decrement_loading_coverage( &mut self, storage: &mut ChunkTicketStorage, pos: ChunkPos, changes: &mut SourceProjectionChanges, )
fn for_each_square_position( center: ChunkPos, distance: u8, visit: impl FnMut(ChunkPos), )
fn for_each_square_ring( center: ChunkPos, inner_distance: u8, outer_distance: u8, visit: impl FnMut(ChunkPos), )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PlayerTicketTracker
impl RefUnwindSafe for PlayerTicketTracker
impl Send for PlayerTicketTracker
impl Sync for PlayerTicketTracker
impl Unpin for PlayerTicketTracker
impl UnsafeUnpin for PlayerTicketTracker
impl UnwindSafe for PlayerTicketTracker
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
Mutably borrows from an owned value. Read more
§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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>