Fix ta4 chest bugs
This commit is contained in:
parent
73c4b95051
commit
e13cd8b924
@ -304,10 +304,10 @@ techage.register_node({"techage:chest_ta4"}, {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
if not mem.filter or not mem.filter["unconfigured"] then
|
|
||||||
mem.filter = mConf.item_filter(pos, 50)
|
mem.filter = mem.filter or mConf.item_filter(pos, 50)
|
||||||
end
|
mem.chest_configured = mem.chest_configured or
|
||||||
mem.chest_configured = mem.chest_configured or #mem.filter["unconfigured"] < 50
|
not mem.filter["unconfigured"] or #mem.filter["unconfigured"] < 50
|
||||||
|
|
||||||
if inv:is_empty("main") then
|
if inv:is_empty("main") then
|
||||||
return nil
|
return nil
|
||||||
@ -337,10 +337,10 @@ techage.register_node({"techage:chest_ta4"}, {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
if not mem.filter or not mem.filter["unconfigured"] then
|
|
||||||
mem.filter = mConf.item_filter(pos, 50)
|
mem.filter = mem.filter or mConf.item_filter(pos, 50)
|
||||||
end
|
mem.chest_configured = mem.chest_configured or
|
||||||
mem.chest_configured = mem.chest_configured or #mem.filter["unconfigured"] < 50
|
not mem.filter["unconfigured"] or #mem.filter["unconfigured"] < 50
|
||||||
|
|
||||||
if mem.chest_configured then
|
if mem.chest_configured then
|
||||||
local name = item:get_name()
|
local name = item:get_name()
|
||||||
@ -354,10 +354,10 @@ techage.register_node({"techage:chest_ta4"}, {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
if not mem.filter or not mem.filter["unconfigured"] then
|
|
||||||
mem.filter = mConf.item_filter(pos, 50)
|
mem.filter = mem.filter or mConf.item_filter(pos, 50)
|
||||||
end
|
mem.chest_configured = mem.chest_configured or
|
||||||
mem.chest_configured = mem.chest_configured or #mem.filter["unconfigured"] < 50
|
not mem.filter["unconfigured"] or #mem.filter["unconfigured"] < 50
|
||||||
|
|
||||||
if mem.chest_configured then
|
if mem.chest_configured then
|
||||||
local name = item:get_name()
|
local name = item:get_name()
|
||||||
|
@ -219,7 +219,7 @@ local function push_item(pos, filter, itemstack, num_items, nvm)
|
|||||||
local idx = 1
|
local idx = 1
|
||||||
local num_pushed = 0
|
local num_pushed = 0
|
||||||
local num_ports = #filter
|
local num_ports = #filter
|
||||||
local randidx = permIdx[num_ports][math.random(1, #permIdx[num_ports])]
|
local randidx = permIdx[num_ports][math.random(1, #(permIdx[num_ports] or {0}))]
|
||||||
local amount = math.floor(math.max((num_items + 1) / num_ports, 1))
|
local amount = math.floor(math.max((num_items + 1) / num_ports, 1))
|
||||||
local num_of_trials = 0
|
local num_of_trials = 0
|
||||||
while num_pushed < num_items and num_of_trials <= 8 do
|
while num_pushed < num_items and num_of_trials <= 8 do
|
||||||
|
@ -25,7 +25,7 @@ function inv_lib.preassigned_stacks(pos, xsize, ysize)
|
|||||||
local item_name = inv:get_stack("conf", idx):get_name()
|
local item_name = inv:get_stack("conf", idx):get_name()
|
||||||
if item_name ~= "" then
|
if item_name ~= "" then
|
||||||
local x = (idx - 1) % xsize
|
local x = (idx - 1) % xsize
|
||||||
local y = math.floor(idx / xsize)
|
local y = math.floor((idx - 1) / xsize)
|
||||||
tbl[#tbl+1] = "item_image["..x..","..y..";1,1;"..item_name.."]"
|
tbl[#tbl+1] = "item_image["..x..","..y..";1,1;"..item_name.."]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -76,7 +76,7 @@ function inv_lib.allow_conf_inv_move(pos, from_list, from_index, to_list, to_ind
|
|||||||
end
|
end
|
||||||
|
|
||||||
function inv_lib.put_items(pos, inv, listname, item, stacks, idx)
|
function inv_lib.put_items(pos, inv, listname, item, stacks, idx)
|
||||||
for _, i in ipairs(stacks) do
|
for _, i in ipairs(stacks or {}) do
|
||||||
if not idx or idx == i then
|
if not idx or idx == i then
|
||||||
local stack = inv:get_stack(listname, i)
|
local stack = inv:get_stack(listname, i)
|
||||||
if stack:item_fits(item) then
|
if stack:item_fits(item) then
|
||||||
|
Loading…
Reference in New Issue
Block a user