aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/execute/simulation.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-03-27 13:49:18 -0600
committermat <git@matdoes.dev>2026-03-28 01:49:34 +0600
commit2d3e4194b885ec499826812da52c965f5a7235cf (patch)
tree9cffc73bb9c5ffa29591392f060816b2c9f321a6 /azalea/src/pathfinder/execute/simulation.rs
parenteeaf1435e81d9cbd8daa0efa22029c1f259a64b5 (diff)
downloadazalea-drasl-2d3e4194b885ec499826812da52c965f5a7235cf.tar.xz
instant path updates for simple paths, and add follow command to testbot
Diffstat (limited to 'azalea/src/pathfinder/execute/simulation.rs')
-rw-r--r--azalea/src/pathfinder/execute/simulation.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/azalea/src/pathfinder/execute/simulation.rs b/azalea/src/pathfinder/execute/simulation.rs
index 7287587b..1b010cca 100644
--- a/azalea/src/pathfinder/execute/simulation.rs
+++ b/azalea/src/pathfinder/execute/simulation.rs
@@ -79,7 +79,7 @@ pub enum SimulatingPathState {
Fail,
Simulated(SimulatingPathOpts),
}
-#[derive(Clone, Component, Debug)]
+#[derive(Clone, Debug)]
pub struct SimulatingPathOpts {
pub start: BlockPos,
pub target: BlockPos,
@@ -89,6 +89,14 @@ pub struct SimulatingPathOpts {
pub sprinting: bool,
pub y_rot: f32,
}
+impl SimulatingPathState {
+ pub fn as_simulated(&self) -> Option<&SimulatingPathOpts> {
+ match self {
+ Self::Fail => None,
+ Self::Simulated(s) => Some(s),
+ }
+ }
+}
#[allow(clippy::type_complexity)]
pub fn tick_execute_path(
@@ -249,6 +257,8 @@ fn run_simulations(
let mut sim = Simulation::new(world_holder.shared.read().chunks.clone(), player.clone());
+ // note that we can't skip more than 50 nodes without causing issues with the
+ // executing_path_limit in goto_listener
for nodes_ahead in [20, 15, 10, 5, 4, 3, 2, 1, 0] {
if nodes_ahead + 1 >= executing_path.path.len() {
// don't simulate to the last node since it has stricter checks