local turtleUtils = {} local IDLE_TIME = 2 turtleUtils.waitForInventory = function(side) local inv = nil while true do inv = peripheral.wrap(side) if inv and peripheral.hasType(inv, 'inventory') then break end os.sleep(IDLE_TIME) end return inv end turtleUtils.trySuckUp = function() while not turtle.suckUp() do os.sleep(IDLE_TIME) end end turtleUtils.tryDrop = function() while true do if turtle.getItemCount() == 0 then return false end local dropOk = turtle.drop(); if (dropOk) then return true end os.sleep(IDLE_TIME) end end turtleUtils.digAll = function() while turtle.dig() do end end turtleUtils.countFreeSlots = function() local freeSlots = 0 for i=1, 16, 1 do if turtle.getItemCount(i) == 0 then freeSlots = freeSlots + 1 end end return freeSlots end turtleUtils.getFuelPercentage = function() return (turtle.getFuelLevel() / turtle.getFuelLimit()) * 100 end return turtleUtils