Inventory enhancements #897: 2, 5, 9, 11, 12 (#931)

* implement a bit

* change shift to ctrl

* add enhancement #2

* add ctrl-interaction with content access

* fix libinventory.move bug (none checking)

* fix p.5

* move shareinv logic into inventory_utils

* add inventory utils

* small refactor

* fix iframe.src = ""

---------

Co-authored-by: MihailRis <mexaruc@gmail.com>
This commit is contained in:
Neveix 2026-08-14 23:25:42 +05:00 • committed by GitHub
parent f8e4e2759b
commit 3b3bf8e878
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 84 additions and 37 deletions

View file

@ -106,6 +106,7 @@ std::shared_ptr<UINode> HudElement::getNode() const {
std::shared_ptr<InventoryView> Hud::createContentAccess() {
auto& content = frontend.getLevel().content;
auto& indices = *content.getIndices();
auto& input = this->input;
auto inventory = player.getInventory();
size_t itemsCount = indices.items.count();
@ -115,12 +116,19 @@ std::shared_ptr<InventoryView> Hud::createContentAccess() {
}
SlotLayout slotLayout(-1, glm::vec2(), false, true, nullptr,
[inventory, &indices](uint, ItemStack& item) {
[inventory, &indices, &input](uint, ItemStack& item) {
auto copy = ItemStack(item);
if (input.pressed(Keycode::LEFT_CONTROL)) {
copy.maximizeCount(indices);
}
inventory->move(copy, indices);
},
[this, inventory](uint, ItemStack& item) {
inventory->getSlot(player.getChosenSlot()).set(item);
[this, inventory, &indices, &input](uint, ItemStack& item) {
auto copy = ItemStack(item);
if (input.pressed(Keycode::LEFT_CONTROL)) {
copy.maximizeCount(indices);
}
inventory->getSlot(player.getChosenSlot()).set(copy);
});
InventoryBuilder builder(gui);