Skip to content

Commit

Permalink
add reaper pathing override param to maps
Browse files Browse the repository at this point in the history
  • Loading branch information
craigham committed Jun 6, 2024
1 parent 14caa02 commit 0ec5f84
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions sc2pathlib/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(
placement_grid: np.ndarray,
height_map: np.ndarray,
playable_area: "sc2.position.Rect",
reaper_overrides:List[tuple[int,int]]
):

self._overlord_spots: Optional[List[Tuple[float, float]]] = None
Expand All @@ -32,6 +33,7 @@ def __init__(
playable_area.y,
playable_area.x + playable_area.width,
playable_area.y + playable_area.height,
reaper_overrides
)

@property
Expand Down
4 changes: 2 additions & 2 deletions src/mapping/climb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ pub fn modify_climb(points: &mut Vec<Vec<map_point::MapPoint>>, x: i32, y: i32,
// 01
// 23

let h0 = points[x1][y1 + 1].height;
let h0 = points[x1][y1 + 1].height;
let h1 = points[x1 + 1][y1 + 1].height;
let h2 = points[x1][y1].height;
let h3 = points[x1 + 1][y1].height;

// Difference between levels is 15.9375 in standard map height maps
// Difference between levels is 2 in standard sc2 measurement units.
// Difference between levels is 2 in standard sc2 measurement units.
// Because of rounding the height difference needs to be exactly 16

let set_low = |x: Cliff| {
Expand Down
20 changes: 16 additions & 4 deletions src/mapping/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ impl Map {
x_start: usize,
y_start: usize,
x_end: usize,
y_end: usize)
y_end: usize,
reaper_overrides: Vec<Vec<usize>>
)
-> Self {
Map::new(pathing, placement, height_map, x_start, y_start, x_end, y_end)
Map::new(pathing, placement, height_map, x_start, y_start, x_end, y_end, reaper_overrides)
}

#[getter(ground_pathing)]
Expand Down Expand Up @@ -281,9 +283,12 @@ impl Map {
x_start: usize,
y_start: usize,
x_end: usize,
y_end: usize)
y_end: usize,
reaper_overrides: Vec<Vec<usize>>
)
-> Self {
let width = pathing.len();

let width = pathing.len();
let height = pathing[0].len();
let mut points = vec![vec![map_point::MapPoint::new(); height]; width];

Expand Down Expand Up @@ -410,6 +415,13 @@ impl Map {
}
}

for pt in reaper_overrides {
println!("x: {}-{}",pt[0], pt[1]);
// println!("x: {pt[0]}, y: {pt[1]}");
reaper_map[pt[0]][pt[1]] = 1;
reaper_map[pt[1]][pt[0]] = 1;
}

let air_pathing = PathFind::new_internal(fly_map);
let colossus_pathing = PathFind::new_internal(reaper_map.clone());
let reaper_pathing = PathFind::new_internal(reaper_map);
Expand Down

0 comments on commit 0ec5f84

Please sign in to comment.