Circular saw: Prevent microblocks from duplicating

This commit is contained in:
Craig Davison 2015-06-15 19:56:40 +01:00
parent 7da13d56b6
commit 56a9c885ff

View File

@ -233,10 +233,18 @@ function circular_saw.allow_metadata_inventory_put(
-- Only accept certain blocks as input which are known to be craftable into stairs:
if listname == "input" then
if not inv:is_empty("input") and
inv:get_stack("input", index):get_name() ~= stackname then
if not inv:is_empty("input") then
if inv:get_stack("input", index):get_name() ~= stackname then
return 0
end
end
if not inv:is_empty("micro") then
local microstackname = inv:get_stack("micro", 1):get_name():gsub("^.+:micro_", "", 1)
local cutstackname = stackname:gsub("^.+:", "", 1)
if microstackname ~= cutstackname then
return 0
end
end
for name, t in pairs(circular_saw.known_nodes) do
if name == stackname and inv:room_for_item("input", stack) then
return count