Made an AI debug view to I can make working on the AI easier. I might add the ability to toggle things on/off live to see what the AI does.

This commit is contained in:
Zed A. Shaw 2025-08-23 01:40:51 -04:00
parent fc8e65f4d6
commit 4bf9a9177f
8 changed files with 60 additions and 16 deletions

View file

@ -17,6 +17,7 @@ int number_left() {
return count;
}
template<typename Comp>
Pathing compute_paths() {
auto& walls_original = GameDB::current_level().map->$walls;
@ -41,6 +42,16 @@ Pathing compute_paths() {
return paths;
}
DinkyECS::Entity Autowalker::camera_aim() {
auto& level = GameDB::current_level();
// what happens if there's two things at that spot
if(level.collision->something_there(fsm.$main_ui.$rayview->aiming_at)) {
return level.collision->get(fsm.$main_ui.$rayview->aiming_at);
} else {
return 0;
}
}
void Autowalker::log(std::wstring msg) {
fsm.$map_ui.log(msg);
}
@ -328,10 +339,10 @@ void Autowalker::process_move(Pathing& paths) {
rotate_player(current, target);
// what are we aiming at?
auto aimed_at = fsm.$main_ui.camera_aim();
auto aimed_at = camera_aim();
if(aimed_at && GameDB::current_world()->has<components::InventoryItem>(aimed_at)) {
// NOTE: if we're aiming at an item then pick it up
// NOTE: if we're aiming at an item then pick it up
// for now just loot it then close to get it off the map
send_event(gui::Event::LOOT_ITEM);
send_event(gui::Event::LOOT_OPEN);