Now the loot UI can work with any container and only uses an ECS id to work, not have its own contents.

This commit is contained in:
Zed A. Shaw 2025-06-21 10:51:45 -04:00
parent a0eff927b6
commit 812407c3df
6 changed files with 70 additions and 34 deletions

View file

@ -27,7 +27,8 @@ namespace gui {
$mini_map($level),
$loot_ui($level),
$font{FONT_FILE_NAME},
$dnd_loot($status_ui, $loot_ui, $window, $router)
$dnd_loot($status_ui, $loot_ui, $window, $router),
$temp_loot($level.world->entity())
{
$window.setPosition({0,0});
}
@ -66,6 +67,8 @@ namespace gui {
$map_ui.log(L"Welcome to the game!");
$mini_map.init($main_ui.$overlay_ui.$gui);
$level.world->set<inventory::Model>($temp_loot, {});
run_systems();
state(State::IDLE);
@ -458,8 +461,8 @@ namespace gui {
case eGUI::LOOT_ITEM: {
dbc::check(world.has<components::InventoryItem>(entity),
"INVALID LOOT_ITEM, that entity has no InventoryItem");
dbc::log("@@@@ SENDING LOOT_ITEM");
$loot_ui.contents.add("item_0", entity);
System::place_in_container(*$level.world, $temp_loot, "item_0", entity);
$loot_ui.set_target($temp_loot);
$loot_ui.update();
event(Event::LOOT_ITEM);
} break;