Loot UI now opens when you can loot something, but it's still buggy and doesn't always show the stuff.
This commit is contained in:
parent
86eabed3db
commit
2458f01ebd
2 changed files with 7 additions and 9 deletions
11
gui/fsm.cpp
11
gui/fsm.cpp
|
@ -568,10 +568,13 @@ namespace gui {
|
||||||
event(Event::INV_SELECT, data);
|
event(Event::INV_SELECT, data);
|
||||||
break;
|
break;
|
||||||
case eGUI::LOOT: {
|
case eGUI::LOOT: {
|
||||||
dbc::check(world.has<components::Sprite>(entity), "inventory doesn't have a sprite");
|
if(world.has<components::InventoryItem>(entity)) {
|
||||||
auto gui_id = $loot_ui.$gui.entity("item_0");
|
auto gui_id = $loot_ui.$gui.entity("item_0");
|
||||||
$loot_ui.contents.insert_or_assign(gui_id, entity);
|
$loot_ui.contents.insert_or_assign(gui_id, entity);
|
||||||
$loot_ui.update();
|
$loot_ui.update();
|
||||||
|
} else {
|
||||||
|
dbc::log("unhandled loot event.");
|
||||||
|
}
|
||||||
event(Event::LOOT_OPEN);
|
event(Event::LOOT_OPEN);
|
||||||
} break;
|
} break;
|
||||||
case eGUI::HP_STATUS:
|
case eGUI::HP_STATUS:
|
||||||
|
|
|
@ -302,8 +302,6 @@ void System::collision(GameLevel &level) {
|
||||||
world.send<Events::GUI>(Events::GUI::COMBAT_START, entity, entity);
|
world.send<Events::GUI>(Events::GUI::COMBAT_START, entity, entity);
|
||||||
}
|
}
|
||||||
} else if(world.has<InventoryItem>(entity)) {
|
} else if(world.has<InventoryItem>(entity)) {
|
||||||
// BUG: this should really be part of the inventory API and I just
|
|
||||||
// call into that to work it, rather than this hard coded crap
|
|
||||||
auto item = world.get<InventoryItem>(entity);
|
auto item = world.get<InventoryItem>(entity);
|
||||||
auto& item_pos = world.get<Position>(entity);
|
auto& item_pos = world.get<Position>(entity);
|
||||||
|
|
||||||
|
@ -318,9 +316,6 @@ void System::collision(GameLevel &level) {
|
||||||
|
|
||||||
collider.remove(item_pos.location);
|
collider.remove(item_pos.location);
|
||||||
world.remove<Tile>(entity);
|
world.remove<Tile>(entity);
|
||||||
|
|
||||||
|
|
||||||
fmt::println("LOOT EVENT, picking up {}", int(entity));
|
|
||||||
world.send<Events::GUI>(Events::GUI::LOOT, entity, item);
|
world.send<Events::GUI>(Events::GUI::LOOT, entity, item);
|
||||||
} else if(world.has<Device>(entity)) {
|
} else if(world.has<Device>(entity)) {
|
||||||
System::device(world, player.entity, entity);
|
System::device(world, player.entity, entity);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue