Work Table : prevent putting unregistered node materials
This commit is contained in:
parent
c468417d7f
commit
cae20d5eee
@ -65,13 +65,13 @@ function worktable.fields(pos, formname, fields, sender)
|
|||||||
local outputcount = outputstack:get_count()
|
local outputcount = outputstack:get_count()
|
||||||
local inputname = inputstack:get_name()
|
local inputname = inputstack:get_name()
|
||||||
local outputname = outputstack:get_name()
|
local outputname = outputstack:get_name()
|
||||||
local shape, get = {}, {}
|
local shape, get, outputshape = {}, {}, {}
|
||||||
local anz = 0
|
local anz = 0
|
||||||
|
|
||||||
for _, d in pairs(def) do
|
for _, d in pairs(def) do
|
||||||
local nb, anz = d[1], d[2]
|
local nb, anz = d[1], d[2]
|
||||||
if outputcount < 99 and fields[nb] then
|
if outputcount < 99 and fields[nb] then
|
||||||
local outputshape = outputname:match(nb)
|
outputshape = outputname:match(nb)
|
||||||
if nb ~= outputshape and outputcount > 0 then return end
|
if nb ~= outputshape and outputcount > 0 then return end
|
||||||
shape = "xdecor:"..nb.."_"..inputname:sub(9)
|
shape = "xdecor:"..nb.."_"..inputname:sub(9)
|
||||||
get = shape.." "..anz
|
get = shape.." "..anz
|
||||||
@ -99,10 +99,13 @@ end
|
|||||||
function worktable.put(pos, listname, index, stack, player)
|
function worktable.put(pos, listname, index, stack, player)
|
||||||
local stackname = stack:get_name()
|
local stackname = stack:get_name()
|
||||||
local count = stack:get_count()
|
local count = stack:get_count()
|
||||||
|
local mat = dump(material)
|
||||||
|
|
||||||
if listname == "output" then return 0 end
|
if listname == "output" then return 0 end
|
||||||
if listname == "input" then
|
if listname == "input" then
|
||||||
if stackname:find("default:") then return count else return 0 end
|
if stackname:find("default:") and mat:match(stackname:sub(9)) then
|
||||||
|
return count
|
||||||
|
else return 0 end
|
||||||
end
|
end
|
||||||
if listname == "hammer" then
|
if listname == "hammer" then
|
||||||
if not (stackname == "xdecor:hammer") then return 0 end
|
if not (stackname == "xdecor:hammer") then return 0 end
|
||||||
|
Loading…
Reference in New Issue
Block a user