mirror of
https://github.com/minetest-mods/technic.git
synced 2025-03-20 11:20:31 +01:00
stack stacks
This commit is contained in:
parent
6077f960c2
commit
29994e917b
@ -137,21 +137,25 @@ local function sort_inventory(inv)
|
|||||||
local m = st:get_metadata()
|
local m = st:get_metadata()
|
||||||
local k = string.format("%s %05d %s", n, w, m)
|
local k = string.format("%s %05d %s", n, w, m)
|
||||||
if not typecnt[k] then
|
if not typecnt[k] then
|
||||||
typecnt[k] = st:to_string()
|
typecnt[k] = {st}
|
||||||
table.insert(typekeys, k)
|
table.insert(typekeys, k)
|
||||||
|
else
|
||||||
|
table.insert(typecnt[k], st)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(typekeys)
|
table.sort(typekeys)
|
||||||
local outlist = {}
|
if #typekeys > #inlist then return end
|
||||||
for _, k in ipairs(typekeys) do
|
local empty_list = {}
|
||||||
table.insert(outlist, ItemStack(typecnt[k]))
|
for i = 1, #inlist do
|
||||||
|
empty_list[i] = ItemStack(nil)
|
||||||
end
|
end
|
||||||
if #outlist > #inlist then return end
|
inv:set_list("main", empty_list)
|
||||||
while #outlist < #inlist do
|
for i = 1, #typekeys do
|
||||||
table.insert(outlist, ItemStack(nil))
|
for k = 1, #typecnt[typekeys[i]] do
|
||||||
|
inv:add_item("main", typecnt[typekeys[i]][k])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
inv:set_list("main", outlist)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_receive_fields(name, data)
|
local function get_receive_fields(name, data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user