aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/moves/basic.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-01-17 22:53:06 +0200
committermat <git@matdoes.dev>2026-01-17 22:53:06 +0200
commita49c8d0b53fed223bab127704c604291ee77f921 (patch)
tree228f9317401decf77d16b1ec6358184d8c3fb241 /azalea/src/pathfinder/moves/basic.rs
parent4d125a7ae042183d177af5070b6d2b1555f65456 (diff)
downloadazalea-drasl-a49c8d0b53fed223bab127704c604291ee77f921.tar.xz
add 'uncommon' pathfinder move category
Diffstat (limited to 'azalea/src/pathfinder/moves/basic.rs')
-rw-r--r--azalea/src/pathfinder/moves/basic.rs56
1 files changed, 1 insertions, 55 deletions
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs
index e5081964..69c949d7 100644
--- a/azalea/src/pathfinder/moves/basic.rs
+++ b/azalea/src/pathfinder/moves/basic.rs
@@ -330,7 +330,7 @@ fn descend_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
})
}
}
-fn execute_descend_move(mut ctx: ExecuteCtx) {
+pub fn execute_descend_move(mut ctx: ExecuteCtx) {
let ExecuteCtx {
target,
start,
@@ -401,60 +401,6 @@ pub fn descend_is_reached(
false
}
-// TODO: disabled for now (for performance), this should probably be moved into
-// its own category of moves
-fn _descend_forward_1_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
- for dir in CardinalDirection::iter() {
- let dir_delta = RelBlockPos::new(dir.x(), 0, dir.z());
- let gap_horizontal_position = pos + dir_delta;
- let new_horizontal_position = pos + dir_delta * 2;
-
- let gap_fall_distance = ctx.world.fall_distance(gap_horizontal_position);
- let fall_distance = ctx.world.fall_distance(new_horizontal_position);
-
- if fall_distance == 0 || fall_distance > 3 || gap_fall_distance < fall_distance {
- continue;
- }
-
- let new_position = new_horizontal_position.down(fall_distance as i32);
-
- // check whether 2 blocks vertically forward are passable
- if !ctx.world.is_passable(new_horizontal_position) {
- continue;
- }
- if !ctx.world.is_passable(gap_horizontal_position) {
- continue;
- }
- // check whether we can stand on the target position
- if !ctx.world.is_standable(new_position) {
- continue;
- }
-
- let cost = WALK_OFF_BLOCK_COST
- + WALK_ONE_BLOCK_COST
- + f32::max(
- FALL_N_BLOCKS_COST
- .get(fall_distance as usize)
- .copied()
- // avoid panicking if we fall more than the size of FALL_N_BLOCKS_COST
- // probably not possible but just in case
- .unwrap_or(f32::INFINITY),
- CENTER_AFTER_FALL_COST,
- );
-
- ctx.edges.push(Edge {
- movement: astar::Movement {
- target: new_position,
- data: MoveData {
- execute: &execute_descend_move,
- is_reached: &descend_is_reached,
- },
- },
- cost,
- })
- }
-}
-
fn diagonal_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
let mut base_cost = SPRINT_ONE_BLOCK_COST;