Merge branch 'main' into feat-inventory-enhancements-p8

This commit is contained in:
neveix 2026-08-15 12:31:34 +05:00
commit a8ec87bdea
10 changed files with 122 additions and 41 deletions

View file

@ -1,4 +1,4 @@
<inventory>
<slots-grid pos="0, 164" rows="1" count="10" sharefunc="inventory_share_func"/>
<slots-grid rows="3" start-index="10" count="30" sharefunc="inventory_share_func"/>
<slots-grid pos="0, 164" rows="1" count="10" sharefunc="share_func"/>
<slots-grid rows="3" start-index="10" count="30" sharefunc="share_func"/>
</inventory>

View file

@ -1,12 +1 @@
function inventory_share_func(invid, slotid)
local blockinv = hud.get_block_inventory()
if blockinv ~= 0 then
inventory.move(invid, slotid, blockinv)
elseif rules.get("allow-content-access") then
inventory.set(invid, slotid, 0, 0)
elseif slotid < 10 then
inventory.move_range(invid, slotid, invid, 10)
else
inventory.move_range(invid, slotid, invid, 0, 9)
end
end
share_func = require("core:inventory_utils").share_default_func

View file

@ -0,0 +1,21 @@
local M = {}
function M.share_default_func(invid, slotid)
local blockinv = hud.get_block_inventory()
local playerinv = player.get_inventory(hud.get_player())
if blockinv ~= 0 then
if invid == blockinv then
inventory.move(blockinv, slotid, playerinv)
else
inventory.move(invid, slotid, blockinv)
end
elseif rules.get("allow-content-access") then
inventory.set(invid, slotid, 0, 0)
elseif slotid < 10 then
inventory.move_range(invid, slotid, invid, 10)
else
inventory.move_range(invid, slotid, invid, 0, 9)
end
end
return M