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

@ -102,6 +102,16 @@ namespace gui {
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) {
auto& slot_name = $slot_to_name.at(gui_id);
auto& inventory = $level.world->get_the<inventory::Model>();
for(auto [ent, slot] : inventory.by_entity) {
fmt::println("BY_ENTITY: ent={}, slot={}", ent, slot);
}
for(auto [slot, ent] : inventory.by_slot) {
fmt::println("BY_SLOT: ent={}, slot={}", ent, slot);
}
$level.world->make_constant(world_entity);
inventory.add(slot_name, world_entity);
update();
return true;
@ -109,6 +119,7 @@ namespace gui {
bool StatusUI::drop_item(DinkyECS::Entity item_id) {
bool dropped = System::drop_item($level, item_id);
$level.world->not_constant(item_id);
if(dropped) update();
return dropped;
}