Autowalker does some basic item pickup now, just for testing.
This commit is contained in:
parent
af933c827a
commit
06a843f169
1 changed files with 12 additions and 1 deletions
|
@ -327,7 +327,18 @@ void Autowalker::process_move(Pathing& paths) {
|
||||||
|
|
||||||
rotate_player(current, target);
|
rotate_player(current, target);
|
||||||
|
|
||||||
send_event(gui::Event::MOVE_FORWARD);
|
// what are we aiming at?
|
||||||
|
auto aimed_at = fsm.$main_ui.camera_aim();
|
||||||
|
|
||||||
|
if(aimed_at && fsm.$level.world->has<components::InventoryItem>(aimed_at)) {
|
||||||
|
// 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);
|
||||||
|
} else {
|
||||||
|
send_event(gui::Event::MOVE_FORWARD);
|
||||||
|
}
|
||||||
|
|
||||||
while(fsm.in_state(gui::State::MOVING)) send_event(gui::Event::TICK);
|
while(fsm.in_state(gui::State::MOVING)) send_event(gui::Event::TICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue