tweak crafter

This commit is contained in:
kepler155c
2018-02-04 23:25:02 -05:00
parent 37e15489ee
commit 9920c0b65a

View File

@@ -234,10 +234,12 @@ local function craftItem(ikey, item, items, machineStatus)
ms.count = ms.count + maxCount ms.count = ms.count + maxCount
end end
for key,qty in pairs(item.recipe.ingredients) do turtle.setStatus('Craft: ' .. itemDB:getName(ikey))
for key,qty in ipairs(item.recipe.ingredients) do
local ingredient = itemDB:get(key) local ingredient = itemDB:get(key)
-- local c = item.craftable * qty -- local c = item.craftable * qty
-- while c > 0 do -- while c > 0 do
--debug(key)
inventoryAdapter:provide(ingredient, maxCount * qty, slot) inventoryAdapter:provide(ingredient, maxCount * qty, slot)
if turtle.getItemCount(slot) ~= maxCount * qty then -- ~= maxCount then FIXXX !!! if turtle.getItemCount(slot) ~= maxCount * qty then -- ~= maxCount then FIXXX !!!
item.status = 'Extract failed: ' .. (ingredient.displayName or itemDB:getName(ingredient)) item.status = 'Extract failed: ' .. (ingredient.displayName or itemDB:getName(ingredient))
@@ -381,6 +383,7 @@ local function craftItems()
jobListGrid:draw() jobListGrid:draw()
jobListGrid:sync() jobListGrid:sync()
end end
turtle.setStatus('idle')
end end
local function loadResources() local function loadResources()
@@ -406,6 +409,8 @@ local function saveResources()
end end
local function findMachines() local function findMachines()
turtle.setStatus('Inspecting machines')
dock() dock()
local function getName(side) local function getName(side)
@@ -1052,5 +1057,6 @@ Event.onInterval(30, function()
craftItems() craftItems()
end) end)
turtle.setStatus('idle')
UI:pullEvents() UI:pullEvents()
jobListGrid.parent:reset() jobListGrid.parent:reset()