Tracked down the bug that was caused by picking up an item but not removing its Position in the world, so when you go to another level it gets brought back to life causing a dupe.

This commit is contained in:
Zed A. Shaw 2025-06-22 12:50:09 -04:00
parent 2c6565c40a
commit e0588847fa
7 changed files with 62 additions and 5 deletions

View file

@ -454,7 +454,7 @@ namespace gui {
break;
case eGUI::AIM_CLICK:
if(auto aimed_at = $main_ui.camera_aim()) {
dbc::log("clicked on a thing");
fmt::println("clicked on a thing: {}", aimed_at);
System::pickup($level, aimed_at);
} else {
dbc::log("there's no thing there!");
@ -463,6 +463,7 @@ namespace gui {
case eGUI::LOOT_ITEM: {
dbc::check(world.has<components::InventoryItem>(entity),
"INVALID LOOT_ITEM, that entity has no InventoryItem");
fmt::println("in FSM LOOT_ITEM the entity is {}", entity);
System::place_in_container(*$level.world, $temp_loot, "item_0", entity);
$loot_ui.set_target($temp_loot);
$loot_ui.update();
@ -509,6 +510,10 @@ namespace gui {
$levels.create_level($level.world);
$level = $levels.next();
// this has to go away, but clear out the inventory
$temp_loot = $level.world->entity();
$level.world->set<inventory::Model>($temp_loot, {});
$status_ui.update_level($level);
$map_ui.update_level($level);
$mini_map.update_level($level);