|
|
@ -102,8 +102,7 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
|
|
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) { |
|
|
|
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) { |
|
|
|
auto& slot_name = $gui.name_for(gui_id); |
|
|
|
auto& slot_name = $gui.name_for(gui_id); |
|
|
|
auto player = $level.world->get_the<components::Player>(); |
|
|
|
auto& inventory = $level.world->get<inventory::Model>($level.player); |
|
|
|
auto& inventory = $level.world->get<inventory::Model>(player.entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(inventory.add(slot_name, world_entity)) { |
|
|
|
if(inventory.add(slot_name, world_entity)) { |
|
|
|
$level.world->make_constant(world_entity); |
|
|
|
$level.world->make_constant(world_entity); |
|
|
@ -123,18 +122,8 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
|
|
// NOTE: do I need this or how does it relate to drop_item?
|
|
|
|
// NOTE: do I need this or how does it relate to drop_item?
|
|
|
|
void StatusUI::remove_slot(guecs::Entity slot_id) { |
|
|
|
void StatusUI::remove_slot(guecs::Entity slot_id) { |
|
|
|
// NOTE: really the System should coordinate either dropping on the
|
|
|
|
|
|
|
|
// ground or moving from one container or another, so when loot_ui
|
|
|
|
|
|
|
|
// moves to use an ECS id to a container I can have the System
|
|
|
|
|
|
|
|
// do it.
|
|
|
|
|
|
|
|
auto& slot_name = $gui.name_for(slot_id); |
|
|
|
auto& slot_name = $gui.name_for(slot_id); |
|
|
|
|
|
|
|
System::remove_from_container(*$level.world, $level.player, slot_name); |
|
|
|
auto player = $level.world->get_the<components::Player>(); |
|
|
|
|
|
|
|
auto& inventory = $level.world->get<inventory::Model>(player.entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto world_entity = inventory.get(slot_name); |
|
|
|
|
|
|
|
inventory.remove(world_entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$gui.remove<guecs::GrabSource>(slot_id); |
|
|
|
$gui.remove<guecs::GrabSource>(slot_id); |
|
|
|
$gui.remove<guecs::Icon>(slot_id); |
|
|
|
$gui.remove<guecs::Icon>(slot_id); |
|
|
|
} |
|
|
|
} |
|
|
@ -143,8 +132,7 @@ namespace gui { |
|
|
|
if(gui_a != gui_b) { |
|
|
|
if(gui_a != gui_b) { |
|
|
|
auto& a_name = $gui.name_for(gui_a); |
|
|
|
auto& a_name = $gui.name_for(gui_a); |
|
|
|
auto& b_name = $gui.name_for(gui_b); |
|
|
|
auto& b_name = $gui.name_for(gui_b); |
|
|
|
auto player = $level.world->get_the<components::Player>(); |
|
|
|
System::inventory_swap($level, $level.player, a_name, b_name); |
|
|
|
System::inventory_swap($level, player.entity, a_name, b_name); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
update(); |
|
|
|
update(); |
|
|
|