mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
move shareinv logic into inventory_utils
This commit is contained in:
parent
5d66c41f80
commit
da7ac66bf8
2 changed files with 3 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
<inventory>
|
<inventory>
|
||||||
<slots-grid pos="0, 164" rows="1" count="10" 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="inventory_share_func"/>
|
<slots-grid rows="3" start-index="10" count="30" sharefunc="share_func"/>
|
||||||
</inventory>
|
</inventory>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1 @@
|
||||||
function inventory_share_func(invid, slotid)
|
share_func = require("core:inventory_utils").share_default_func
|
||||||
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
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue