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