pub struct EffectDefinition { /* private fields */ }Expand description
Author-defined effect metadata.
Implementations§
Source§impl EffectDefinition
impl EffectDefinition
Sourcepub fn new(id: impl Into<EffectId>) -> Self
pub fn new(id: impl Into<EffectId>) -> Self
Creates an indefinite, single-stack effect definition.
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Returns the display name intended for UI/docs.
Sourcepub fn default_duration_secs(&self) -> Option<f32>
pub fn default_duration_secs(&self) -> Option<f32>
Returns the default duration for newly applied instances.
Sourcepub fn duration_secs(self, duration_secs: f32) -> Self
pub fn duration_secs(self, duration_secs: f32) -> Self
Sets the default duration for newly applied instances.
Sourcepub fn indefinite(self) -> Self
pub fn indefinite(self) -> Self
Makes newly applied instances indefinite.
Sourcepub fn max_stacks_value(&self) -> u32
pub fn max_stacks_value(&self) -> u32
Returns the maximum stack count for this effect.
Sourcepub fn max_stacks(self, max_stacks: u32) -> Self
pub fn max_stacks(self, max_stacks: u32) -> Self
Sets the maximum stack count. Values below 1 are normalized to 1.
Sourcepub fn attribute(
self,
key: impl Into<String>,
value: impl Into<ContentValue>,
) -> Self
pub fn attribute( self, key: impl Into<String>, value: impl Into<ContentValue>, ) -> Self
Adds or replaces an author-defined gameplay attribute.
Sourcepub fn get_attribute(&self, key: &str) -> Option<&ContentValue>
pub fn get_attribute(&self, key: &str) -> Option<&ContentValue>
Returns a gameplay attribute by key.
Sourcepub fn number_attribute(&self, key: &str) -> Option<f64>
pub fn number_attribute(&self, key: &str) -> Option<f64>
Returns a numeric gameplay attribute by key.
Sourcepub fn bool_attribute(&self, key: &str) -> Option<bool>
pub fn bool_attribute(&self, key: &str) -> Option<bool>
Returns a boolean gameplay attribute by key.
Sourcepub fn text_attribute(&self, key: &str) -> Option<&str>
pub fn text_attribute(&self, key: &str) -> Option<&str>
Returns a text gameplay attribute by key.
Sourcepub fn attributes(&self) -> &HashMap<String, ContentValue>
pub fn attributes(&self) -> &HashMap<String, ContentValue>
Returns all gameplay attributes.
Returns all author-defined tags.
Sourcepub fn snapshot(&self) -> EffectDefinitionSnapshot
pub fn snapshot(&self) -> EffectDefinitionSnapshot
Creates a serializable, deterministic snapshot of this effect definition.
Trait Implementations§
Source§impl Clone for EffectDefinition
impl Clone for EffectDefinition
Source§impl Debug for EffectDefinition
impl Debug for EffectDefinition
Source§impl PartialEq for EffectDefinition
impl PartialEq for EffectDefinition
impl StructuralPartialEq for EffectDefinition
Auto Trait Implementations§
impl Forget for EffectDefinition
impl Freeze for EffectDefinition
impl Move for EffectDefinition
impl RefUnwindSafe for EffectDefinition
impl Send for EffectDefinition
impl Sync for EffectDefinition
impl Unpin for EffectDefinition
impl UnsafeUnpin for EffectDefinition
impl UnwindSafe for EffectDefinition
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 more