aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-10-03 01:13:08 -0500
committermat <git@matdoes.dev>2023-10-03 01:13:08 -0500
commite9c5231336b95c0d2e93c96279b8cac036b45527 (patch)
treef7aee0562432ce8fab4bd03da3b023cc44d20a22
parente847f46c0b1eb27649528fa3d06a3e12b48cc734 (diff)
downloadazalea-drasl-e9c5231336b95c0d2e93c96279b8cac036b45527.tar.xz
tweak pathfinder costs
-rw-r--r--azalea/src/pathfinder/costs.rs1
-rw-r--r--azalea/src/pathfinder/mod.rs1
-rw-r--r--azalea/src/pathfinder/moves/basic.rs2
-rw-r--r--azalea/src/pathfinder/moves/parkour.rs9
4 files changed, 6 insertions, 7 deletions
diff --git a/azalea/src/pathfinder/costs.rs b/azalea/src/pathfinder/costs.rs
index 8ec2a49c..8465fff3 100644
--- a/azalea/src/pathfinder/costs.rs
+++ b/azalea/src/pathfinder/costs.rs
@@ -8,6 +8,7 @@ pub const SPRINT_ONE_BLOCK_COST: f32 = 20. / 5.612;
pub const FALL_ONE_BLOCK_COST: f32 = 0.5;
pub const WALK_OFF_BLOCK_COST: f32 = WALK_ONE_BLOCK_COST * 0.8;
pub const SPRINT_MULTIPLIER: f32 = SPRINT_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;
+pub const JUMP_PENALTY: f32 = 2.;
pub static FALL_1_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(1.25));
pub static FALL_0_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(0.25));
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index f4d16ca5..03d161fc 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -470,6 +470,7 @@ fn tick_execute_path(
goal,
successors_fn,
});
+ pathfinder.is_calculating = true;
if pathfinder.path.is_empty() {
if let Some(new_path) = pathfinder.queued_path.take() {
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs
index b7bb1116..26a77f4e 100644
--- a/azalea/src/pathfinder/moves/basic.rs
+++ b/azalea/src/pathfinder/moves/basic.rs
@@ -80,7 +80,7 @@ fn ascend_move(ctx: &PathfinderCtx, pos: BlockPos) -> Vec<Edge> {
continue;
}
- let cost = SPRINT_ONE_BLOCK_COST + *JUMP_ONE_BLOCK_COST;
+ let cost = SPRINT_ONE_BLOCK_COST + JUMP_PENALTY + *JUMP_ONE_BLOCK_COST;
edges.push(Edge {
movement: astar::Movement {
diff --git a/azalea/src/pathfinder/moves/parkour.rs b/azalea/src/pathfinder/moves/parkour.rs
index 27763257..77e591d6 100644
--- a/azalea/src/pathfinder/moves/parkour.rs
+++ b/azalea/src/pathfinder/moves/parkour.rs
@@ -40,7 +40,7 @@ fn parkour_forward_1_move(ctx: &PathfinderCtx, pos: BlockPos) -> Vec<Edge> {
continue;
}
- let cost = *JUMP_ONE_BLOCK_COST + SPRINT_ONE_BLOCK_COST + SPRINT_ONE_BLOCK_COST;
+ let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 2.;
edges.push(Edge {
movement: astar::Movement {
@@ -91,10 +91,7 @@ fn parkour_forward_2_move(ctx: &PathfinderCtx, pos: BlockPos) -> Vec<Edge> {
continue;
}
- let cost = *JUMP_ONE_BLOCK_COST
- + SPRINT_ONE_BLOCK_COST
- + SPRINT_ONE_BLOCK_COST
- + SPRINT_ONE_BLOCK_COST;
+ let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 3.;
edges.push(Edge {
movement: astar::Movement {
@@ -135,7 +132,7 @@ fn parkour_headhitter_forward_1_move(ctx: &PathfinderCtx, pos: BlockPos) -> Vec<
continue;
}
- let cost = *JUMP_ONE_BLOCK_COST + WALK_ONE_BLOCK_COST + WALK_ONE_BLOCK_COST;
+ let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST + WALK_ONE_BLOCK_COST;
edges.push(Edge {
movement: astar::Movement {