Now items drop where you aim, and won't let you drop on a floor. But maybe one more change.

This commit is contained in:
Zed A. Shaw 2025-08-02 23:11:59 -04:00
parent 23ead1f0ca
commit 1788b8fb28
3 changed files with 21 additions and 41 deletions

View file

@ -112,8 +112,7 @@ namespace gui {
case AIM_CLICK: {
// take from inventory, drop on floor
bool worked = throw_on_floor($status_ui.$gui, true);
dbc::check(worked, "Need to fix this, should be able to abort.");
END(CLOSE);
if(worked) END(CLOSE);
} break;
case INV_SELECT: {
auto drop_id = std::any_cast<guecs::Entity>(data);
@ -139,8 +138,7 @@ namespace gui {
case AIM_CLICK: {
// THIS IS PUT IT BACK ON THE FLOOR
bool worked = throw_on_floor($loot_ui.$gui, false);
dbc::check(worked, "Failed to drop it back on the floor.");
END(CLOSE);
if(worked) END(CLOSE);
} break;
default:
handle_mouse(ev, $loot_ui.$gui);
@ -196,7 +194,6 @@ namespace gui {
}
void DNDLoot::clear_grab() {
dbc::log("CLEARED!");
$grab_source = std::nullopt;
$grab_sprite = nullptr;
}
@ -291,7 +288,6 @@ namespace gui {
"StatusUI doesn't actually have that GrabSource in the gui.");
auto& grab = gui.get<guecs::GrabSource>(*$grab_source);
grab.commit();
bool result = false;
@ -301,7 +297,11 @@ namespace gui {
result = $loot_ui.drop_item(grab.world_entity);
}
clear_grab();
if(result) {
grab.commit();
clear_grab();
}
return result;
}