Skip to content

Commit 9281e4f

Browse files
committed
fix some parkour issues
1 parent 44fda05 commit 9281e4f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

azalea/src/pathfinder/moves/parkour.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn parkour_forward_1_move(edges: &mut Vec<Edge>, ctx: &PathfinderCtx, pos: Block
4848
continue;
4949
}
5050

51-
let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 2.;
51+
let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 2. + CENTER_AFTER_FALL_COST;
5252

5353
edges.push(Edge {
5454
movement: astar::Movement {
@@ -102,7 +102,7 @@ fn parkour_forward_2_move(edges: &mut Vec<Edge>, ctx: &PathfinderCtx, pos: Block
102102
continue;
103103
}
104104

105-
let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 3.;
105+
let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 3. + CENTER_AFTER_FALL_COST;
106106

107107
edges.push(Edge {
108108
movement: astar::Movement {
@@ -132,11 +132,7 @@ fn parkour_forward_3_move(edges: &mut Vec<Edge>, ctx: &PathfinderCtx, pos: Block
132132
continue;
133133
}
134134

135-
let ascend: i32 = if ctx.is_standable(pos + offset.up(1)) {
136-
1
137-
} else if ctx.is_standable(pos + offset) {
138-
0
139-
} else {
135+
if !ctx.is_standable(pos + offset) {
140136
continue;
141137
};
142138

@@ -158,11 +154,11 @@ fn parkour_forward_3_move(edges: &mut Vec<Edge>, ctx: &PathfinderCtx, pos: Block
158154
continue;
159155
}
160156

161-
let cost = JUMP_PENALTY + WALK_ONE_BLOCK_COST * 3.;
157+
let cost = JUMP_PENALTY + SPRINT_ONE_BLOCK_COST * 4. + CENTER_AFTER_FALL_COST;
162158

163159
edges.push(Edge {
164160
movement: astar::Movement {
165-
target: pos + offset.up(ascend),
161+
target: pos + offset,
166162
data: MoveData {
167163
execute: &execute_parkour_move,
168164
is_reached: &default_is_reached,
@@ -237,8 +233,6 @@ pub fn parkour_is_reached(
237233
position, target, ..
238234
}: IsReachedCtx,
239235
) -> bool {
240-
let target_center = target.center();
241-
242236
// 0.094 and not 0 for lilypads
243237
BlockPos::from(position) == target && (position.y - target.y as f64) < 0.094
244238
}

0 commit comments

Comments
 (0)