move shareinv logic into inventory_utils

This commit is contained in:
neveix 2026-08-14 14:38:41 +05:00
parent 5d66c41f80
commit da7ac66bf8
2 changed files with 3 additions and 14 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