diff --git a/src/entities/shared_systems/pathfinding.rs b/src/entities/shared_systems/pathfinding.rs index ed355bb..da87f18 100644 --- a/src/entities/shared_systems/pathfinding.rs +++ b/src/entities/shared_systems/pathfinding.rs @@ -155,9 +155,10 @@ struct PathNode { impl Ord for PathNode { fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.f_score - .cmp(&other.f_score) - .then_with(|| self.g_score.cmp(&other.g_score)) + other + .f_score + .cmp(&self.f_score) + .then_with(|| other.g_score.cmp(&self.g_score)) } } @@ -559,7 +560,8 @@ fn is_standable_tile(tilemap: &TileMap, pos: IVec3) -> bool { /// Returns 100 (default) if tile not found. #[inline] fn get_tile_weight(tilemap: &TileMap, pos: IVec3) -> u8 { - tilemap.get_astar_weight(pos) + let floor_pos = IVec3::new(pos.x, pos.y, pos.z - ITILE_SIZE); + tilemap.get_astar_weight(floor_pos) } /// Calculate movement cost including tile weight.