mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
* 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:
parent
f8e4e2759b
commit
3b3bf8e878
9 changed files with 84 additions and 37 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue