Compare commits

..

No commits in common. "9c5bad5959bccba2492abb26d4bd1b0e7bc380f2" and "ca3b04b89565c74a0d97a02e3418a21363fefd94" have entirely different histories.

4 changed files with 12 additions and 10 deletions

View file

@ -202,10 +202,9 @@ void Autowalker::handle_player_walk(ai::State& start, ai::State& goal) {
status(L"USING HEALING"); status(L"USING HEALING");
player_use_healing(); player_use_healing();
} else if(action.name == "collect_items") { } else if(action.name == "collect_items") {
send_event(gui::Event::STAIRS_DOWN); status(L"COLLECTING ITEMS");
// status(L"COLLECTING ITEMS"); auto paths = path_to_items();
// auto paths = path_to_items(); process_move(paths);
// process_move(paths);
// path to the items and get them all // path to the items and get them all
} else if(action == ai::FINAL_ACTION) { } else if(action == ai::FINAL_ACTION) {
close_status(); close_status();

View file

@ -67,7 +67,7 @@ namespace gui {
void FSM::MOVING(Event ) { void FSM::MOVING(Event ) {
// this should be an optional that returns a point // this should be an optional that returns a point
if(auto move_to = $main_ui.play_move()) { if(auto move_to = $main_ui.play_move()) {
System::move_player(*move_to); System::plan_motion(*move_to);
run_systems(); run_systems();
$main_ui.dirty(); $main_ui.dirty();
state(State::IDLE); state(State::IDLE);

View file

@ -407,12 +407,15 @@ void System::device(World &world, Entity actor, Entity item) {
} }
} }
void System::move_player(Position move_to) { void System::plan_motion(Position move_to) {
auto& level = GameDB::current_level(); auto& level = GameDB::current_level();
auto old_pos = level.world->get<Position>(level.player); auto& player_pos = GameDB::player_position();
level.world->set<Position>(level.player, move_to); player_pos.aiming_at = move_to.aiming_at;
level.collision->move(old_pos.location, move_to.location, level.player);
auto& motion = level.world->get<Motion>(level.player);
motion.dx = move_to.location.x - player_pos.location.x;
motion.dy = move_to.location.y - player_pos.location.y;
} }

View file

@ -23,7 +23,7 @@ namespace System {
void enemy_ai_initialize(); void enemy_ai_initialize();
void device(World &world, Entity actor, Entity item); void device(World &world, Entity actor, Entity item);
void move_player(Position move_to); void plan_motion(Position move_to);
Entity spawn_item(World& world, const string& name); Entity spawn_item(World& world, const string& name);
void drop_item(Entity item); void drop_item(Entity item);