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

This commit is contained in:
Zed A. Shaw 2025-07-06 12:05:28 -04:00
parent af3568154a
commit 265e53e05a
2 changed files with 11 additions and 12 deletions

View file

@ -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
event(Event::AIM_CLICK);
}
} break;
case eGUI::AIM_CLICK:
event(Event::AIM_CLICK);
break;
case eGUI::LOOT_ITEM: {
dbc::check(world.has<components::InventoryItem>(entity),
"INVALID LOOT_ITEM, that entity has no InventoryItem");

View file

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