feat(tutle-utils): add isInventoryFull method
This commit is contained in:
parent
c5dcfaf2b7
commit
a78ed6dba3
@ -3,6 +3,16 @@ local turtleUtils = {}
|
||||
local DEFAULT_IDLE_TIME = 2
|
||||
local DEFAULT_MIN_FUEL_NEEDED = 1000
|
||||
|
||||
local function isTurtleInventoryFull()
|
||||
for i=1, 16, 1 do
|
||||
if turtle.getItemCount(i) == 0 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
turtleUtils.isFuelItem = function(item)
|
||||
item = item or {}
|
||||
|
||||
@ -42,6 +52,17 @@ turtleUtils.isInventoryEmpty = function()
|
||||
return true
|
||||
end
|
||||
|
||||
turtleUtils.isInventoryFull = function(withCompact)
|
||||
local isFull = isTurtleInventoryFull()
|
||||
|
||||
if isFull and withCompact then
|
||||
turtleUtils.compactInventory()
|
||||
return isTurtleInventoryFull()
|
||||
end
|
||||
|
||||
return isFull
|
||||
end
|
||||
|
||||
turtleUtils.getItemName = function(slotIndex)
|
||||
local item = turtle.getItemDetail(slotIndex)
|
||||
return item and item.name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user