pub struct GotoEvent {
pub entity: Entity,
pub goal: Arc<dyn Goal + Send + Sync>,
pub successors_fn: SuccessorsFn,
pub allow_mining: bool,
pub min_timeout: PathfinderTimeout,
pub max_timeout: PathfinderTimeout,
}
Expand description
Send this event to start pathfinding to the given goal.
Also see PathfinderClientExt::goto
.
This event is read by goto_listener
.
Fields§
§entity: Entity
The local bot entity that will do the pathfinding and execute the path.
goal: Arc<dyn Goal + Send + Sync>
§successors_fn: SuccessorsFn
The function that’s used for checking what moves are possible. Usually
pathfinder::moves::default_move
allow_mining: bool
Whether the bot is allowed to break blocks while pathfinding.
min_timeout: PathfinderTimeout
The minimum amount of time that should pass before the A* pathfinder
function can return a timeout. It may take up to Self::max_timeout
if it can’t immediately find a usable path.
A good default value for this is
PathfinderTimeout::Time(Duration::from_secs(1))
.
Also see PathfinderTimeout::Nodes
max_timeout: PathfinderTimeout
The absolute maximum amount of time that the pathfinder function can take to find a path. If it takes this long, it means no usable path was found (so it might be impossible).
A good default value for this is
PathfinderTimeout::Time(Duration::from_secs(5))
.
Trait Implementations§
Source§impl Component for GotoEvent
impl Component for GotoEvent
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks
].§fn register_required_components(
_component_id: ComponentId,
_components: &mut Components,
_storages: &mut Storages,
_required_components: &mut RequiredComponents,
_inheritance_depth: u16,
)
fn register_required_components( _component_id: ComponentId, _components: &mut Components, _storages: &mut Storages, _required_components: &mut RequiredComponents, _inheritance_depth: u16, )
Source§impl Event for GotoEvent
impl Event for GotoEvent
Source§const AUTO_PROPAGATE: bool = false
const AUTO_PROPAGATE: bool = false
Trigger::propagate
.Source§type Traversal = ()
type Traversal = ()
Auto Trait Implementations§
impl Freeze for GotoEvent
impl !RefUnwindSafe for GotoEvent
impl Send for GotoEvent
impl Sync for GotoEvent
impl Unpin for GotoEvent
impl !UnwindSafe for GotoEvent
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
§fn register_required_components(
components: &mut Components,
storages: &mut Storages,
required_components: &mut RequiredComponents,
)
fn register_required_components( components: &mut Components, storages: &mut Storages, required_components: &mut RequiredComponents, )
Bundle
].§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Bundle
]’s component ids. This will be None
if the component has not been registered.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§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>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§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.§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.