#[non_exhaustive]pub struct GotoEvent {
pub entity: Entity,
pub goal: Arc<dyn Goal>,
pub successors_fn: SuccessorsFn,
pub allow_mining: bool,
pub retry_on_no_path: 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 (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.entity: Entity
The local bot entity that will do the pathfinding and execute the path.
goal: Arc<dyn Goal>
§successors_fn: SuccessorsFn
The function that’s used for checking what moves are possible. Usually
moves::default_move
.
allow_mining: bool
Whether the bot is allowed to break blocks while pathfinding.
retry_on_no_path: bool
Whether we should recalculate the path when the pathfinder timed out and there’s no partial path to try.
Should usually be set to true.
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))
.
Implementations§
Source§impl GotoEvent
impl GotoEvent
pub fn new(entity: Entity, goal: impl Goal + 'static) -> Self
pub fn with_successors_fn(self, successors_fn: SuccessorsFn) -> Self
pub fn with_allow_mining(self, allow_mining: bool) -> Self
pub fn with_retry_on_no_path(self, retry_on_no_path: bool) -> Self
pub fn with_min_timeout(self, min_timeout: PathfinderTimeout) -> Self
pub fn with_max_timeout(self, max_timeout: PathfinderTimeout) -> Self
Trait Implementations§
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 = ()
§fn register_component_id(world: &mut World) -> ComponentId
fn register_component_id(world: &mut World) -> ComponentId
ComponentId
] for this event type. Read more§fn component_id(world: &World) -> Option<ComponentId>
fn component_id(world: &World) -> Option<ComponentId>
ComponentId
] for this event type,
if it has already been generated. Read moreAuto 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<T> CompatExt for T
impl<T> CompatExt for T
§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>
, which can then be
downcast
into Box<dyn 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>
, which 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.