screeps_pathfinding/utils/neighbors.rs
1use screeps::constants::Direction;
2use screeps::{Position, RoomXY};
3
4pub fn room_xy_neighbors(node: RoomXY) -> Vec<RoomXY> {
5 node.neighbors()
6}
7
8pub fn position_neighbors(node: Position) -> Vec<Position> {
9 Direction::iter()
10 .filter_map(|dir| node.checked_add_direction(*dir).ok())
11 .collect()
12}