Can now round-trip a torch from loot to inventory and back.

This commit is contained in:
Zed A. Shaw 2025-06-09 14:02:26 -04:00
parent 4b0d76bbcc
commit 2a6b892e7f
5 changed files with 80 additions and 22 deletions

View file

@ -100,13 +100,13 @@ namespace gui {
return $gui.get<guecs::DropTarget>(gui_id);
}
void StatusUI::begin_drop(DinkyECS::Entity entity) {
$selected_entity = entity;
void StatusUI::begin_drop(DinkyECS::Entity world_entity) {
$selected_entity = world_entity;
}
bool StatusUI::commit_drop(DinkyECS::Entity gui_id) {
// BUG: just roll this into DropTarget
auto& drop = get_drop_target(gui_id);
return drop.commit();
}
@ -121,11 +121,17 @@ namespace gui {
}
std::optional<DinkyECS::Entity> StatusUI::begin_grab(DinkyECS::Entity slot_id) {
(void)slot_id;
return std::nullopt;
// BET CHAT: I'll have to change this to a full if-else later
if(!$slots.contains(slot_id)) return std::nullopt;
auto& source = get_grab_source(slot_id);
source.grab();
return $slots.at(slot_id);
}
void StatusUI::commit_grab(DinkyECS::Entity slot_id) {
(void)slot_id;
$slots.erase(slot_id);
$gui.remove<guecs::Sprite>(slot_id);
}
}