|
|
@ -130,6 +130,32 @@ void Autowalker::rotate_player(Point current, Point target) { |
|
|
|
"player isn't facing the correct direction"); |
|
|
|
"player isn't facing the correct direction"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Autowalker::show_map_overlay(matrix::Matrix& map, Point current) { |
|
|
|
|
|
|
|
auto debug = fsm.$level.world->get_the<components::Debug>(); |
|
|
|
|
|
|
|
if(!debug.FPS) { |
|
|
|
|
|
|
|
fsm.$main_ui.$overlay_ui.close_text("top_right"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string map_overlay; |
|
|
|
|
|
|
|
for(matrix::box it{map, current.x, current.y, 6}; it.next();) { |
|
|
|
|
|
|
|
if(it.x == it.left) map_overlay += "\n"; |
|
|
|
|
|
|
|
int cell = map[it.y][it.x]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(it.x == current.x && it.y == current.y) { |
|
|
|
|
|
|
|
map_overlay += fmt::format("{:x}<", cell); |
|
|
|
|
|
|
|
} else if(cell == WALL_PATH_LIMIT) { |
|
|
|
|
|
|
|
map_overlay += fmt::format("# "); |
|
|
|
|
|
|
|
} else if(cell > 15) { |
|
|
|
|
|
|
|
map_overlay += fmt::format("* "); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
map_overlay += fmt::format("{:x} ", cell); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fsm.$main_ui.$overlay_ui.show_text("top_right", map_overlay); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Autowalker::autowalk() { |
|
|
|
void Autowalker::autowalk() { |
|
|
|
window_events(); |
|
|
|
window_events(); |
|
|
|
if(!fsm.autowalking) return; |
|
|
|
if(!fsm.autowalking) return; |
|
|
@ -159,7 +185,8 @@ void Autowalker::autowalk() { |
|
|
|
Point current = get_current_position(); |
|
|
|
Point current = get_current_position(); |
|
|
|
Point target = current; |
|
|
|
Point target = current; |
|
|
|
|
|
|
|
|
|
|
|
matrix::dump("AUTO PATHS", paths.$paths, current.x, current.y); |
|
|
|
show_map_overlay(paths.$paths, current); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!path_player(paths, target)) { |
|
|
|
if(!path_player(paths, target)) { |
|
|
|
dbc::log("no paths found, aborting autowalk"); |
|
|
|
dbc::log("no paths found, aborting autowalk"); |
|
|
|