Fix shift-clicking and a few luacheck warnings

This commit is contained in:
Mikita Wiśniewski 2024-06-26 11:52:26 +07:00 committed by the-real-herowl
parent c5bc6ff189
commit f1fa6240bb
5 changed files with 18 additions and 15 deletions

View file

@ -6,7 +6,6 @@ local get_double_container_neighbor_pos = mcl_util.get_double_container_neighbor
local string = string
local table = table
local math = math
local sf = string.format
@ -381,7 +380,7 @@ local function limit_put_list(stack, list)
end
local function limit_put(stack, top_inv, bottom_inv)
local leftover = ItemStack(staick)
local leftover = ItemStack(stack)
leftover = limit_put_list(leftover, top_inv:get_list("main"))
leftover = limit_put_list(leftover, bottom_inv:get_list("main"))
return stack:get_count() - leftover:get_count()
@ -496,9 +495,17 @@ local function log_inventory_put_double(side) return function(pos, listname, ind
" moves stuff to chest at " .. minetest.pos_to_string(pos))
-- BEGIN OF LISTRING WORKAROUND
if listname == "input" then
local top_inv, bottom_inv = get_chest_inventories(pos, side)
top_inv:set_stack("input", 1, nil)
double_chest_add_item(top_inv, bottom_inv, "main", stack)
local inv = minetest.get_inventory({ type = "node", pos = pos })
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)
if side == "left" then
double_chest_add_item(inv, other_inv, "main", stack)
else
double_chest_add_item(other_inv, inv, "main", stack)
end
end
-- END OF LISTRING WORKAROUND
end end

View file

@ -1,6 +1,4 @@
local S = minetest.get_translator(minetest.get_current_modname())
local F = minetest.formspec_escape
local C = minetest.colorize
local get_double_container_neighbor_pos = mcl_util.get_double_container_neighbor_pos
local chestusage = S("To access its inventory, rightclick it. When broken, the items will drop out.")

View file

@ -1,6 +1,4 @@
local string = string
local table = table
local math = math
local sm = string.match