gghf

unload

Jul 14th, 2022
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. -- definition
  2. local function unload(_bKeepOneFuelStack)
  3.     print("Unloading items...")
  4.     for n = 1, 16 do
  5.         local nCount = turtle.getItemCount(n)
  6.         if nCount > 0 then
  7.             turtle.select(n)
  8.             local bDrop = true
  9.             if _bKeepOneFuelStack and turtle.refuel(0) then
  10.                 bDrop = false
  11.                 _bKeepOneFuelStack = false
  12.             end
  13.             if bDrop then
  14.                 turtle.drop()
  15.                 unloaded = unloaded + nCount
  16.             end
  17.         end
  18.     end
  19.     collected = 0
  20.     turtle.select(1)
  21. end
  22.  
  23. -- export
  24. return { unload = unload }
Advertisement
Add Comment
Please, Sign In to add comment