recipe nbts + item get/add helper
This commit is contained in:
@@ -131,6 +131,7 @@ local function turtleCraft(recipe, storage, request, count)
|
||||
if storage:export(storage.turtleInventory, k, count, item) ~= count then
|
||||
request.status = 'unknown error'
|
||||
request.statusCode = Craft.STATUS_ERROR
|
||||
|
||||
_debug('failed to export: ' .. item.name)
|
||||
return
|
||||
end
|
||||
@@ -203,18 +204,11 @@ local function adjustCounts(recipe, count, ingredients, storage)
|
||||
-- increment crafted
|
||||
local result = ingredients[recipe.result]
|
||||
result.count = result.count + (count * recipe.count)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function Craft.craftRecipeInternal(recipe, count, storage, origItem)
|
||||
local request = origItem.ingredients[recipe.result]
|
||||
|
||||
if request.aborted then
|
||||
_debug('aborted')
|
||||
return 0
|
||||
end
|
||||
|
||||
if origItem.pending[recipe.result] then
|
||||
request.status = 'processing'
|
||||
request.statusCode = Craft.STATUS_INFO
|
||||
@@ -281,6 +275,12 @@ _G._p = origItem.ingredients
|
||||
canCraft = canCraft - maxCount
|
||||
end
|
||||
|
||||
if request.aborted then
|
||||
origItem.aborted = true
|
||||
_debug('aborted')
|
||||
return 0
|
||||
end
|
||||
|
||||
return crafted * recipe.count
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user