gghf icon

unload

gghf | PRO | 07/14/22 09:56:47 AM UTC | 0 ⭐ | 985 👁️ | Never ⏰ | []
Lua |

620 B

|

None

|

0 👍

/

0 👎

-- definition
local function unload(_bKeepOneFuelStack)
    print("Unloading items...")
    for n = 1, 16 do
        local nCount = turtle.getItemCount(n)
        if nCount > 0 then
            turtle.select(n)
            local bDrop = true
            if _bKeepOneFuelStack and turtle.refuel(0) then
                bDrop = false
                _bKeepOneFuelStack = false
            end
            if bDrop then
                turtle.drop()
                unloaded = unloaded + nCount
            end
        end
    end
    collected = 0
    turtle.select(1)
end
 
-- export
return { unload = unload }

Comments