pub struct FlipState {
pub active_side: WorldSide,
pub progress: f64,
pub revision: u64,
}Expand description
Persistent, server-authoritative state shared by every flip equipment slot.
Fields§
§active_side: WorldSideSide currently presented by all flip slots.
progress: f64Normalized accumulated progress in the range [0, progress_threshold).
revision: u64Monotonic animation key incremented once for every completed flip.
Implementations§
Source§impl FlipState
impl FlipState
Sourcepub fn accumulate(
&mut self,
source: FlipProgressSource,
amount: f64,
progress_threshold: f64,
) -> Result<Option<FlipTransition>, FlipProgressError>
pub fn accumulate( &mut self, source: FlipProgressSource, amount: f64, progress_threshold: f64, ) -> Result<Option<FlipTransition>, FlipProgressError>
Adds one normalized gain and returns a transition when it reaches the threshold. Overflow is discarded and one call can flip at most once.
Sourcepub fn retarget_progress(&mut self, progress_threshold: f64)
pub fn retarget_progress(&mut self, progress_threshold: f64)
Re-denominates accumulated progress against a threshold that just got
smaller — putting on ART-03 Halfway Bell moves the bar under charge
the player already earned.
The charge is kept, not zeroed: it is parked immediately below the new
bar so the very next gain of any size flips. Zeroing (what
FlipState::accumulate does to an out-of-range accumulator) would
silently burn up to a full gauge on an equip, and flipping outright here
would hand out a free transition for putting an artifact on and taking it
off again.
Sourcepub fn sanitize_progress(&mut self, progress_threshold: f64)
pub fn sanitize_progress(&mut self, progress_threshold: f64)
Restores the accumulator invariant after loading durable state.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FlipState
impl<'de> Deserialize<'de> for FlipState
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>,
Source§impl FromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
impl FromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
Source§impl IntoWasmAbi for FlipState
impl IntoWasmAbi for FlipState
Source§impl JsonSchema for FlipState
impl JsonSchema for FlipState
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl OptionFromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
Source§impl OptionIntoWasmAbi for FlipState
impl OptionIntoWasmAbi for FlipState
Source§impl RefFromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
impl RefFromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
Self are recovered from.Source§impl Tsify for FlipState
impl Tsify for FlipState
const DECL: &'static str = "/**\n * Persistent, server-authoritative state shared by every flip equipment slot.\n */\nexport interface FlipState {\n /**\n * Side currently presented by all flip slots.\n */\n active_side: WorldSide;\n /**\n * Normalized accumulated progress in the range `[0, progress_threshold)`.\n */\n progress: number;\n /**\n * Monotonic animation key incremented once for every completed flip.\n */\n revision: number;\n}"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl VectorFromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
impl VectorFromWasmAbi for FlipStatewhere
Self: DeserializeOwned,
type Abi = <JsType as VectorFromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>
Source§impl VectorIntoWasmAbi for FlipState
impl VectorIntoWasmAbi for FlipState
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
impl Copy for FlipState
impl Eq for FlipState
Auto Trait Implementations§
impl Freeze for FlipState
impl RefUnwindSafe for FlipState
impl Send for FlipState
impl Sync for FlipState
impl Unpin for FlipState
impl UnwindSafe for FlipState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.