forked from minetest-mods/moreblocks
Speedup get_output_inv
This commit is contained in:
parent
6491d0be42
commit
7bd98ac02c
@ -84,6 +84,8 @@ function circular_saw:get_output_inv(modname, material, amount, max)
|
|||||||
if (not max or max < 1 or max > 99) then max = 99 end
|
if (not max or max < 1 or max > 99) then max = 99 end
|
||||||
|
|
||||||
local list = {}
|
local list = {}
|
||||||
|
local pos = #list
|
||||||
|
|
||||||
-- If there is nothing inside, display empty inventory:
|
-- If there is nothing inside, display empty inventory:
|
||||||
if amount < 1 then
|
if amount < 1 then
|
||||||
return list
|
return list
|
||||||
@ -91,8 +93,9 @@ function circular_saw:get_output_inv(modname, material, amount, max)
|
|||||||
|
|
||||||
for i, t in ipairs(circular_saw.names) do
|
for i, t in ipairs(circular_saw.names) do
|
||||||
local cost = circular_saw.cost_in_microblocks[i]
|
local cost = circular_saw.cost_in_microblocks[i]
|
||||||
table.insert(list, modname .. ":" .. t[1] .. "_" .. material .. t[2]
|
pos = pos + 1
|
||||||
.. " " .. math.min(math.floor(amount/cost), max))
|
list[pos] = modname .. ":" .. t[1] .. "_" .. material .. t[2]
|
||||||
|
.. " " .. math.min(math.floor(amount/cost), max)
|
||||||
end
|
end
|
||||||
return list
|
return list
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user