pub(crate) struct WorldClockManager {
clocks: FxHashMap<Identifier, ClockState>,
}Expand description
Per-world clock instances.
Vanilla 26.2 owns one clock manager at server scope and every loaded level delegates to it. Steel intentionally persists one manager in each world’s level data instead: equal clock keys are not shared, so two overworlds in the same domain can advance and be configured independently.
Fields§
§clocks: FxHashMap<Identifier, ClockState>Implementations§
Source§impl WorldClockManager
impl WorldClockManager
pub(crate) fn new() -> Self
Sourcepub(crate) fn initialize_registered_clocks(
&mut self,
) -> Result<bool, WorldClockLoadError>
pub(crate) fn initialize_registered_clocks( &mut self, ) -> Result<bool, WorldClockLoadError>
Validates loaded states and creates default instances for newly registered clocks.
pub(crate) fn total_ticks(&self, clock: WorldClockRef) -> Option<i64>
pub(crate) fn set_total_ticks( &mut self, clock: WorldClockRef, total_ticks: i64, ) -> Option<()>
pub(crate) fn add_ticks( &mut self, clock: WorldClockRef, ticks: i32, ) -> Option<i64>
pub(crate) fn set_paused( &mut self, clock: WorldClockRef, paused: bool, ) -> Option<()>
pub(crate) fn set_rate(&mut self, clock: WorldClockRef, rate: f32) -> Option<()>
Sourcepub(crate) fn move_to_time_marker(
&mut self,
clock: WorldClockRef,
marker_key: &Identifier,
) -> Option<bool>
pub(crate) fn move_to_time_marker( &mut self, clock: WorldClockRef, marker_key: &Identifier, ) -> Option<bool>
Moves a clock to a marker, returning false when that marker is not defined for it.
Sourcepub(crate) fn tick(&mut self, advance_time: bool) -> bool
pub(crate) fn tick(&mut self, advance_time: bool) -> bool
Advances all unpaused clocks once when the world’s advance_time rule allows it.
pub(crate) fn network_updates( &self, advance_time: bool, ) -> Vec<(i32, i64, f32, f32)>
pub(crate) fn network_update( &self, clock: WorldClockRef, advance_time: bool, ) -> Option<(i32, i64, f32, f32)>
Trait Implementations§
Source§impl Clone for WorldClockManager
impl Clone for WorldClockManager
Source§fn clone(&self) -> WorldClockManager
fn clone(&self) -> WorldClockManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorldClockManager
impl Debug for WorldClockManager
Source§impl Default for WorldClockManager
impl Default for WorldClockManager
Source§fn default() -> WorldClockManager
fn default() -> WorldClockManager
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for WorldClockManager
impl<'de> Deserialize<'de> for WorldClockManager
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for WorldClockManager
impl PartialEq for WorldClockManager
Source§impl Serialize for WorldClockManager
impl Serialize for WorldClockManager
impl StructuralPartialEq for WorldClockManager
Auto Trait Implementations§
impl Freeze for WorldClockManager
impl RefUnwindSafe for WorldClockManager
impl Send for WorldClockManager
impl Sync for WorldClockManager
impl Unpin for WorldClockManager
impl UnsafeUnpin for WorldClockManager
impl UnwindSafe for WorldClockManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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<>>