|
|
@ -135,4 +135,25 @@ namespace gui { |
|
|
|
$gui.remove<guecs::GrabSource>(slot_id); |
|
|
|
$gui.remove<guecs::GrabSource>(slot_id); |
|
|
|
$gui.remove<guecs::Sprite>(slot_id); |
|
|
|
$gui.remove<guecs::Sprite>(slot_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StatusUI::swap(guecs::Entity gui_a, guecs::Entity gui_b) { |
|
|
|
|
|
|
|
if(gui_a != gui_b) { |
|
|
|
|
|
|
|
auto& inventory = $level.world->get_the<inventory::Model>(); |
|
|
|
|
|
|
|
auto& a_name = $slot_to_name.at(gui_a); |
|
|
|
|
|
|
|
auto& b_name = $slot_to_name.at(gui_b); |
|
|
|
|
|
|
|
auto a_ent = inventory.get(a_name); |
|
|
|
|
|
|
|
auto b_ent = inventory.get(b_name); |
|
|
|
|
|
|
|
inventory.swap(a_ent, b_ent); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool StatusUI::occupied(guecs::Entity slot) { |
|
|
|
|
|
|
|
dbc::check($slot_to_name.contains(slot), "jank ass slot to name thing isn't loaded right you idiot."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto& inventory = $level.world->get_the<inventory::Model>(); |
|
|
|
|
|
|
|
auto& slot_name = $slot_to_name.at(slot); |
|
|
|
|
|
|
|
return inventory.has(slot_name); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|