pub struct AiActionDispatchToUserCode {
pub entity: Entity,
pub action_key: ActionKey,
pub action_name: String,
pub action_context: ActionContextRef,
pub action_score: ActionScore,
}Expand description
An Event that signals that Cranium is handing off to the user code by running any registered ActionHandlers.
Primarily used as a trigger to kick off a System that handles calling an appropriate user function from the registry - the registry is NonSend, so we are doing this in a separate System to not force the main decision logic to run on the main thread.
Fields§
§entity: EntityThe AI that picked this Action for execution.
action_key: ActionKeyIdentifier for the handling event (e.g. “GoTo”). This is effectively a link to the implementation of the action.
action_name: StringHuman-readable primary identifier; one action_key may handle distinct action_names (e.g. action_key “GoTo” may cover action_names “Walk”, “Run”, “Flee”, etc.). In other words, this is what this action represents semantically, and is less likely to change for technical purposes.
action_context: ActionContextRefThe Context of the Action, i.e. the static input(s) we scored against.
action_score: ActionScoreThe Utility score; this is so that we can decide whether to possibly override this with a higher-priority Action later on.
Implementations§
Source§impl AiActionDispatchToUserCode
impl AiActionDispatchToUserCode
pub fn new( ai_owner: Entity, action_key: ActionKey, action_name: String, action_context: ActionContext, action_score: ActionScore, ) -> Self
Trait Implementations§
Source§impl Debug for AiActionDispatchToUserCode
impl Debug for AiActionDispatchToUserCode
impl Message for AiActionDispatchToUserCode
Auto Trait Implementations§
impl Freeze for AiActionDispatchToUserCode
impl RefUnwindSafe for AiActionDispatchToUserCode
impl Send for AiActionDispatchToUserCode
impl Sync for AiActionDispatchToUserCode
impl Unpin for AiActionDispatchToUserCode
impl UnsafeUnpin for AiActionDispatchToUserCode
impl UnwindSafe for AiActionDispatchToUserCode
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
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<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