diff options
| author | mat <git@matdoes.dev> | 2024-12-28 01:48:25 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-12-28 01:48:25 +0000 |
| commit | ebaf5128fbc87970b2ba1f6157e5da035ae379c8 (patch) | |
| tree | 7b9ee030fd6c9551bc3c8f3695f66e9f452de8ac /azalea/src/pathfinder | |
| parent | 5693191b57973136188bdade2144a69ac61a9f8a (diff) | |
| download | azalea-drasl-ebaf5128fbc87970b2ba1f6157e5da035ae379c8.tar.xz | |
better pathfinder debug messages
Diffstat (limited to 'azalea/src/pathfinder')
| -rw-r--r-- | azalea/src/pathfinder/goals.rs | 4 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/azalea/src/pathfinder/goals.rs b/azalea/src/pathfinder/goals.rs index 531e4036..0fb72446 100644 --- a/azalea/src/pathfinder/goals.rs +++ b/azalea/src/pathfinder/goals.rs @@ -1,6 +1,6 @@ //! The goals that a pathfinder can try to reach. -use std::f32::consts::SQRT_2; +use std::{f32::consts::SQRT_2, fmt::Debug}; use azalea_core::position::{BlockPos, Vec3}; use azalea_world::ChunkStorage; @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; use super::costs::{COST_HEURISTIC, FALL_N_BLOCKS_COST, JUMP_ONE_BLOCK_COST}; -pub trait Goal { +pub trait Goal: Debug { #[must_use] fn heuristic(&self, n: BlockPos) -> f32; #[must_use] diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 01375590..95982215 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -235,6 +235,7 @@ pub fn goto_listener( let Ok((mut pathfinder, executing_path, position, instance_name, inventory)) = query.get_mut(event.entity) else { + warn!("got goto event for an entity that can't pathfind"); continue; }; @@ -243,6 +244,7 @@ pub fn goto_listener( pathfinder.goal = None; pathfinder.successors_fn = None; pathfinder.is_calculating = false; + debug!("already at goal, not pathfinding"); continue; } @@ -262,10 +264,16 @@ pub fn goto_listener( } else { BlockPos::from(position) }; - info!( - "got goto, starting from {start:?} (currently at {:?})", - BlockPos::from(position) - ); + + if start == BlockPos::from(position) { + info!("got goto {:?}, starting from {start:?}", event.goal); + } else { + info!( + "got goto {:?}, starting from {start:?} (currently at {:?})", + event.goal, + BlockPos::from(position) + ); + } let successors_fn: moves::SuccessorsFn = event.successors_fn; |
