Make the AIM_CLICK handler in FSM properly deal with an item already there while looting or not. Closes #56.
This commit is contained in:
parent
87e69bebde
commit
584c4e9f67
6 changed files with 41 additions and 25 deletions
20
gui/fsm.cpp
20
gui/fsm.cpp
|
@ -463,15 +463,17 @@ namespace gui {
|
|||
case eGUI::INV_SELECT:
|
||||
event(Event::INV_SELECT, data);
|
||||
break;
|
||||
case eGUI::AIM_CLICK:
|
||||
if(auto aimed_at = $main_ui.camera_aim()) {
|
||||
fmt::println("clicked on a thing: {}", aimed_at);
|
||||
System::pickup($level, aimed_at);
|
||||
} else {
|
||||
fmt::println("SENDING AIM_CLICK");
|
||||
event(Event::AIM_CLICK);
|
||||
}
|
||||
break;
|
||||
case eGUI::AIM_CLICK: {
|
||||
auto aimed_at = $main_ui.camera_aim();
|
||||
|
||||
if(aimed_at && !in_state(State::LOOTING)) {
|
||||
// aimed at something and not looting so it's a pickup
|
||||
System::pickup($level, aimed_at);
|
||||
} else {
|
||||
// otherwise just repeat the event and let the FSM deal
|
||||
event(Event::AIM_CLICK);
|
||||
}
|
||||
} break;
|
||||
case eGUI::LOOT_ITEM: {
|
||||
dbc::check(world.has<components::InventoryItem>(entity),
|
||||
"INVALID LOOT_ITEM, that entity has no InventoryItem");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue