milo use parallel during crafting for ingredients (holy shit thats fast)
This commit is contained in:
@@ -131,15 +131,23 @@ local function turtleCraft(recipe, storage, request, count)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local failed
|
||||||
|
local fns = { }
|
||||||
for k,v in pairs(recipe.ingredients) do
|
for k,v in pairs(recipe.ingredients) do
|
||||||
local item = splitKey(v)
|
local item = splitKey(v)
|
||||||
if storage:export(storage.turtleInventory, k, count, item) ~= count then
|
table.insert(fns, function()
|
||||||
request.status = 'rescan needed ?'
|
if storage:export(storage.turtleInventory, k, count, item) ~= count then
|
||||||
request.statusCode = Craft.STATUS_ERROR
|
request.status = 'rescan needed ?'
|
||||||
|
request.statusCode = Craft.STATUS_ERROR
|
||||||
|
failed = true
|
||||||
|
_debug('failed to export: ' .. item.name)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
_debug('failed to export: ' .. item.name)
|
parallel.waitForAll(table.unpack(fns))
|
||||||
return
|
if failed then
|
||||||
end
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
turtle.select(1)
|
turtle.select(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user