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:
Zed A. Shaw 2025-07-03 22:26:06 -04:00
parent 87e69bebde
commit 584c4e9f67
6 changed files with 41 additions and 25 deletions

View file

@ -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");