mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
tweak pathfinder costs
This commit is contained in:
parent
e847f46c0b
commit
e9c5231336
4 changed files with 6 additions and 7 deletions
|
@ -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));
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue