Simple fix, and honestly I should eliminate this whole thing and use one unified event system. Closes #1.

master
Zed A. Shaw 15 hours ago
parent af3568154a
commit 265e53e05a
  1. 20
      gui/fsm.cpp
  2. 1
      gui/main_ui.cpp

@ -198,6 +198,14 @@ namespace gui {
case MOUSE_MOVE:
mouse_action(true);
break;
case AIM_CLICK: {
auto aimed_at = $main_ui.camera_aim();
if(aimed_at) {
// this will then send LOOT_ITEM if it's valid
System::pickup($level, aimed_at);
}
} break;
default:
break; // ignore everything else
}
@ -465,17 +473,9 @@ namespace gui {
case eGUI::INV_SELECT:
event(Event::INV_SELECT, data);
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
case eGUI::AIM_CLICK:
event(Event::AIM_CLICK);
}
} break;
break;
case eGUI::LOOT_ITEM: {
dbc::check(world.has<components::InventoryItem>(entity),
"INVALID LOOT_ITEM, that entity has no InventoryItem");

@ -103,7 +103,6 @@ namespace gui {
$rayview.update_level($level);
$rayview.position_camera(player.x + 0.5, player.y + 0.5);
// BUG #57: I think this is in the wrong direction?
player_position.aiming_at = $rayview.aiming_at;
$compass_dir = 0;

Loading…
Cancel
Save