fix(inferium-harvester): several crashes on retrieveFertilizedEssences function
This commit is contained in:
parent
1784bfb93e
commit
1b0b172e9a
@ -3,7 +3,7 @@ local utils = require('libs/utils')
|
||||
local inferium = require('libs/inferium')
|
||||
local turtleUtils = require('libs/turtle-utils')
|
||||
|
||||
local VERSION = "4.1.0"
|
||||
local VERSION = "4.1.1"
|
||||
local IDLE_TIME = 2
|
||||
local WAIT_ITEM_IDLE_TIME = 5
|
||||
local NETWORK_TIMEOUT = 4
|
||||
@ -440,20 +440,20 @@ local function retrieveFertilizedEssences(_)
|
||||
local slot = getItemSlot(storageInventory, inferium.FERTILIZED_ESSENCE)
|
||||
|
||||
if slot then
|
||||
local inventoryCount = getCountItem(storageInventory, inferium.FERTILIZED_ESSENCE)
|
||||
local inventoryCount = getCountItem(storageInventory, inferium.FERTILIZED_ESSENCE) or 0
|
||||
local realCount = math.min(MAX_FERTILIZED_ESSENCE, inventoryCount)
|
||||
|
||||
print('> retrieve ' .. tostring(realCount) .. ' fertilized essences from storage')
|
||||
local pushOk = storageInventory.pushItems(peripheral.getName(bufferInventory), slot, realCount)
|
||||
|
||||
if not pushOk then
|
||||
error('retrieveFertilizedEssences error: cannot pushItems from storage to buffer')
|
||||
return false
|
||||
end
|
||||
|
||||
local suckOk = turtle.suck()
|
||||
|
||||
if not suckOk then
|
||||
error('retrieveFertilizedEssences error: cannot suck items from buffer')
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user