Resolve teknomunk's comments

This commit is contained in:
Mikita Wiśniewski 2024-06-27 21:04:29 +07:00 committed by the-real-herowl
parent f1fa6240bb
commit 7bf15642ca

View file

@ -207,12 +207,12 @@ if screwdriver then
end end
mcl_chests.no_rotate, mcl_chests.simple_rotate = no_rotate, simple_rotate mcl_chests.no_rotate, mcl_chests.simple_rotate = no_rotate, simple_rotate
--[[ List of open chests -- List of open chests
------------------- -- -------------------
Key: Player name -- Key: Player name
Value: -- Value:
If player is using a chest: { pos = <chest node position> } -- If player is using a chest: { pos = <chest node position> }
Otherwise: nil ]] -- Otherwise: nil
local open_chests = {} local open_chests = {}
mcl_chests.open_chests = open_chests mcl_chests.open_chests = open_chests
@ -397,13 +397,11 @@ local function close_forms(canonical_basename, pos)
end end
local function get_chest_inventories(pos, side) local function get_chest_inventories(pos, side)
local node = minetest.get_node(pos) local inv = minetest.get_inventory({ type = "node", pos = pos })
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local node = minetest.get_node(pos)
local pos_other = get_double_container_neighbor_pos(pos, node.param2, side) local pos_other = get_double_container_neighbor_pos(pos, node.param2, side)
local meta_other = minetest.get_meta(pos_other) local inv_other = minetest.get_inventory({ type = "node", pos = pos_other })
local inv_other = meta_other:get_inventory()
local top_inv, bottom_inv local top_inv, bottom_inv
if side == "left" then if side == "left" then
@ -495,17 +493,12 @@ local function log_inventory_put_double(side) return function(pos, listname, ind
" moves stuff to chest at " .. minetest.pos_to_string(pos)) " moves stuff to chest at " .. minetest.pos_to_string(pos))
-- BEGIN OF LISTRING WORKAROUND -- BEGIN OF LISTRING WORKAROUND
if listname == "input" then if listname == "input" then
local inv = minetest.get_inventory({ type = "node", pos = pos }) local top_inv, bottom_inv = get_chest_inventories(pos, side)
local other_pos = get_double_container_neighbor_pos(pos, minetest.get_node(pos).param2, side)
local other_inv = minetest.get_inventory({ type = "node", pos = other_pos })
inv:set_stack("input", 1, nil) top_inv:set_stack("input", 1, nil)
bottom_inv:set_stack("input", 1, nil)
if side == "left" then double_chest_add_item(top_inv, bottom_inv, "main", stack)
double_chest_add_item(inv, other_inv, "main", stack)
else
double_chest_add_item(other_inv, inv, "main", stack)
end
end end
-- END OF LISTRING WORKAROUND -- END OF LISTRING WORKAROUND
end end end end