plethora networked autocrafting

This commit is contained in:
kepler155c
2018-10-20 23:53:49 -04:00
parent 0db3ad47bb
commit d5c102054a
4 changed files with 109 additions and 36 deletions

View File

@@ -10,17 +10,17 @@ local USER_RECIPES = 'usr/config/recipes.db'
local Craft = { }
local function clearGrid(inventoryAdapter)
for i = 1, 16 do
local count = turtle.getItemCount(i)
if count > 0 then
inventoryAdapter:insert(i, count)
if turtle.getItemCount(i) ~= 0 then
-- inventory is possibly full
return false
end
end
end
return true
turtle.eachFilledSlot(function(slot)
inventoryAdapter:insert(slot.index, slot.count, nil, slot)
end)
for i = 1, 16 do
if turtle.getItemCount(i) ~= 0 then
return false
end
end
return true
end
local function splitKey(key)