pub struct ItemBasedSteering {
boosting: bool,
boost_time: i32,
}Expand description
Runtime state for vanilla ItemBasedSteering.
Fields§
§boosting: bool§boost_time: i32Implementations§
Source§impl ItemBasedSteering
impl ItemBasedSteering
Sourcepub const fn on_synced(&mut self)
pub const fn on_synced(&mut self)
Marks a boost as active without rolling a new duration, used when boost state arrives from synced or loaded data.
Sourcepub fn boost(&mut self) -> Option<i32>
pub fn boost(&mut self) -> Option<i32>
Starts a boost if one isn’t already active, returning a random total duration in ticks.
Sourcepub const fn tick_boost(&mut self, boost_time_total: i32)
pub const fn tick_boost(&mut self, boost_time_total: i32)
Advances the active boost by one tick, ending it once past boost_time_total.
Sourcepub fn boost_factor(&self, boost_time_total: i32) -> f32
pub fn boost_factor(&self, boost_time_total: i32) -> f32
Returns the current speed multiplier while boosting, ramping via a sine curve over the boost duration; 1.0 when not boosting.
Sourcepub const fn is_boosting(&self) -> bool
pub const fn is_boosting(&self) -> bool
Returns whether a boost is currently active.
Sourcepub const fn boost_time(&self) -> i32
pub const fn boost_time(&self) -> i32
Returns ticks elapsed since the current boost started.
Trait Implementations§
Source§impl Debug for ItemBasedSteering
impl Debug for ItemBasedSteering
Auto Trait Implementations§
impl Freeze for ItemBasedSteering
impl RefUnwindSafe for ItemBasedSteering
impl Send for ItemBasedSteering
impl Sync for ItemBasedSteering
impl Unpin for ItemBasedSteering
impl UnsafeUnpin for ItemBasedSteering
impl UnwindSafe for ItemBasedSteering
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<>>