pub struct NoCurveMatchStrategyConfig(pub NoCurveMatchStrategy);Expand description
A Resource that represents app-wide configuration for how to handle bad Curve keys.
Tuple Fields§
§0: NoCurveMatchStrategyImplementations§
Source§impl NoCurveMatchStrategyConfig
impl NoCurveMatchStrategyConfig
pub fn get_current_value(&self) -> &NoCurveMatchStrategy
Sourcepub fn set(&mut self, strategy: NoCurveMatchStrategy) -> &mut Self
pub fn set(&mut self, strategy: NoCurveMatchStrategy) -> &mut Self
Sets the handler to one of the supported strategies (panic, skip, default, etc.).
Sourcepub fn set_panic(&mut self) -> &mut Self
pub fn set_panic(&mut self) -> &mut Self
Configures the app to panic if a Curve key cannot be resolved to a Curve.
This is the default behavior, so this method is only useful if something else has already modified the default settings.
Sourcepub fn set_skip_consideration(&mut self) -> &mut Self
pub fn set_skip_consideration(&mut self) -> &mut Self
Configures the app to ignore the Consideration and log a warning
if its associated Curve key cannot be resolved to a Curve.
WARNING: This is generally NOT recommended as it is roughly equivalent to returning max score on error, so you may run actions that should not be valid and processing Considerations that should have been optimized away, so it may be a footgun - but you do you.
Sourcepub fn set_skip_action(&mut self) -> &mut Self
pub fn set_skip_action(&mut self) -> &mut Self
Configures the app to discard the whole Action and log a warning
if any of its Considerations’ associated Curve keys cannot be
resolved to a Curve.
This means any buggy Actions effectively get disabled; this means the application can keep on truckin’ in case of designer errors, but the AIs may be missing some capabilities.
However, this may be desirable if you have multiple versions of an ActionTemplate, each compatible with a different version of your app/modding API/whatever other integration things you are exposing.
Sourcepub fn set_log_and_use_default<F: CurveResolverFn + 'static>(
&mut self,
curve_resolver: F,
) -> &mut Self
pub fn set_log_and_use_default<F: CurveResolverFn + 'static>( &mut self, curve_resolver: F, ) -> &mut Self
Configures the app to log a warning if a Curve key cannot be
resolves to a Curve and select a fallback Curve using the
provided ('static!) mapping function instead.
This allows for graceful recovery in case of AI designer error, but puts the responsibility on the user to specify good fallbacks.
Broadly speaking, fallbacks should try to match the expected Curve first on
order relation class (increasing/decreasing/peaking, if peaking - how many peaks),
then secondarily on ‘falloff sharpness similarity’ (we could try to define it with derivatives,
but you probably get the idea informally - e.g. MoreThan > Exponential > Square > Linear).
It does not need to be perfect, but the closer the match, the better your chances are that things will still work reasonably well using the fallback.
If you are happy handling the resolution, this is probably the most robust strategy, giving you both a crash-free experience and a log warning about the fallback used.
Sourcepub fn set_silently_use_default<F: CurveResolverFn + 'static>(
&mut self,
curve_resolver: F,
) -> &mut Self
pub fn set_silently_use_default<F: CurveResolverFn + 'static>( &mut self, curve_resolver: F, ) -> &mut Self
Configures the app to select a fallback Curve using the
provided ('static!) mapping function if a Curve key cannot
be resolves to a Curve without logging a warning.
This allows for graceful recovery in case of AI designer error, but puts the responsibility on the user to specify good fallbacks.
Broadly speaking, fallbacks should try to match the expected Curve first on order relation class (increasing/decreasing/peaking, if peaking - how many peaks), then secondarily on ‘falloff sharpness’ (we could try to define it with derivatives, but you probably get the idea - e.g. Exponential is sharper than Square than Linear).
It does not need to be perfect, but the closer the match, the better your chances are that things will still work reasonably well using the fallback.
As you might guess, this is effectively a quiet variant of DefaultCurveWithLog.
The primary use-case for this would be if you are using a lot of custom Curves and are very confident in your fallback resolution doing a good job and you want to reduce warning-spam without necessarily filtering out the warnings from the library altogether.
Trait Implementations§
Source§impl Component for NoCurveMatchStrategyConfig
impl Component for NoCurveMatchStrategyConfig
Source§const STORAGE_TYPE: StorageType = ::bevy::ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = ::bevy::ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Default for NoCurveMatchStrategyConfig
impl Default for NoCurveMatchStrategyConfig
impl Resource for NoCurveMatchStrategyConfig
Auto Trait Implementations§
impl !RefUnwindSafe for NoCurveMatchStrategyConfig
impl !UnwindSafe for NoCurveMatchStrategyConfig
impl Freeze for NoCurveMatchStrategyConfig
impl Send for NoCurveMatchStrategyConfig
impl Sync for NoCurveMatchStrategyConfig
impl Unpin for NoCurveMatchStrategyConfig
impl UnsafeUnpin for NoCurveMatchStrategyConfig
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
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