Speed-up the Work Table cutting function

This commit is contained in:
jp 2015-08-02 18:58:47 +02:00
parent 28c397044a
commit 5ee2a6da90

View File

@ -63,23 +63,18 @@ local function xfields(pos, formname, fields, sender)
local shape, get = {}, {} local shape, get = {}, {}
local anz = 0 local anz = 0
for m=1, #material do for _, d in pairs(def) do
for n=1, #def do local nb, anz = d[1], d[2]
local v = material[m] if outputstack:get_count() < 99 and fields[nb] then
local w = def[n] shape = "xdecor:"..nb.."_"..string.sub(inputstack:get_name(), 9)
if (inputstack:get_name() == "default:"..v) and
(outputstack:get_count() < 99) and fields[w[1]] then
shape = "xdecor:"..w[1].."_"..v
anz = w[2]
get = shape.." "..anz get = shape.." "..anz
if not minetest.registered_nodes[shape] then return end
inv:add_item("output", get) inv:add_item("output", get)
inputstack:take_item() inputstack:take_item()
inv:set_stack("input", 1, inputstack) inv:set_stack("input", 1, inputstack)
end end
end end
end
end end
local function xdig(pos, player) local function xdig(pos, player)