diff --git a/autowalker.cpp b/autowalker.cpp index 2658dd3..ba29a2f 100644 --- a/autowalker.cpp +++ b/autowalker.cpp @@ -202,9 +202,10 @@ void Autowalker::handle_player_walk(ai::State& start, ai::State& goal) { status(L"USING HEALING"); player_use_healing(); } else if(action.name == "collect_items") { - status(L"COLLECTING ITEMS"); - auto paths = path_to_items(); - process_move(paths); + send_event(gui::Event::STAIRS_DOWN); + // status(L"COLLECTING ITEMS"); + // auto paths = path_to_items(); + // process_move(paths); // path to the items and get them all } else if(action == ai::FINAL_ACTION) { close_status(); diff --git a/gui/fsm.cpp b/gui/fsm.cpp index c1acf74..840df0a 100644 --- a/gui/fsm.cpp +++ b/gui/fsm.cpp @@ -67,7 +67,7 @@ namespace gui { void FSM::MOVING(Event ) { // this should be an optional that returns a point if(auto move_to = $main_ui.play_move()) { - System::plan_motion(*move_to); + System::move_player(*move_to); run_systems(); $main_ui.dirty(); state(State::IDLE); diff --git a/systems.cpp b/systems.cpp index a0f0f87..62c70f7 100644 --- a/systems.cpp +++ b/systems.cpp @@ -407,15 +407,12 @@ void System::device(World &world, Entity actor, Entity item) { } } -void System::plan_motion(Position move_to) { +void System::move_player(Position move_to) { auto& level = GameDB::current_level(); - auto& player_pos = GameDB::player_position(); + auto old_pos = level.world->get(level.player); - player_pos.aiming_at = move_to.aiming_at; - - auto& motion = level.world->get(level.player); - motion.dx = move_to.location.x - player_pos.location.x; - motion.dy = move_to.location.y - player_pos.location.y; + level.world->set(level.player, move_to); + level.collision->move(old_pos.location, move_to.location, level.player); } diff --git a/systems.hpp b/systems.hpp index 30d07fa..dbbbbdd 100644 --- a/systems.hpp +++ b/systems.hpp @@ -23,7 +23,7 @@ namespace System { void enemy_ai_initialize(); void device(World &world, Entity actor, Entity item); - void plan_motion(Position move_to); + void move_player(Position move_to); Entity spawn_item(World& world, const string& name); void drop_item(Entity item);