Struct BehaviorCx
pub struct BehaviorCx<'a> { /* private fields */ }Expand description
What a Behavior runs with: its mob and the tick’s read view — the
same mob-tick view crate::GoalContext is (the ticking mob itself, the
player the tick sees, the snapshot of the others), with the brain’s own
memories typed on top. Writes go through the engine’s own setters.
Implementations§
§impl<'a> BehaviorCx<'a>
impl<'a> BehaviorCx<'a>
pub fn host(&self) -> &dyn Host
pub fn host(&self) -> &dyn Host
The read view of the mob’s tick, as crate::GoalContext::host.
pub fn walk_target(&self) -> Option<BrainWalkTarget>
pub fn walk_target(&self) -> Option<BrainWalkTarget>
WALK_TARGET, where the brain walks to.
pub fn look_target(&self) -> Option<[f64; 3]>
pub fn look_target(&self) -> Option<[f64; 3]>
LOOK_TARGET, the position the brain looks at.
pub fn attack_target(&self) -> Option<LivingRef>
pub fn attack_target(&self) -> Option<LivingRef>
ATTACK_TARGET, the living entity the brain attacks, as the tick’s
view resolves it.
pub fn set_brain_target(&mut self, target: Option<LivingRef>) -> bool
pub fn set_brain_target(&mut self, target: Option<LivingRef>) -> bool
set_brain_target on the mob’s own handle: writes the brain’s
ATTACK_TARGET memory through the engine’s setter, with its refusals
(a species whose brain keeps no attack target refuses, as the write
handle does). None clears it.
pub fn set_walk_target(&mut self, at: [i32; 3], speed: f64, close: i32)
pub fn set_walk_target(&mut self, at: [i32; 3], speed: f64, close: i32)
SetWalkTarget: writes the brain’s WALK_TARGET memory through the
engine’s own path, where the brain’s walk sink takes it from.