CaptainSpaceCat

Wood Plank Treater

May 12th, 2022 (edited)
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. SLOT_OUTPUT = 16
  2.  
  3. function intro()
  4.     turtle.select(6)
  5.     if turtle.getItemCount() > 0 then
  6.         turtle.select(SLOT_OUTPUT)
  7.         turtle.craft()
  8.         turtle.dropDown()
  9.     end
  10.    
  11.     turtle.select(6)
  12.     turtle.drop()
  13.    
  14.     turtle.select(1)
  15.     num = turtle.getItemCount()
  16.     for i = 1, num do
  17.         doCrafting()
  18.     end
  19. end
  20.  
  21. function safeSuck()
  22.     while not turtle.suck() do
  23.         sleep(0.5)
  24.     end
  25. end
  26.  
  27. function getPlanks()
  28.     indices = {1, 2, 3, 5, 7, 9, 10, 11}
  29.     for _, i in pairs(indices) do
  30.         turtle.select(i)
  31.         turtle.suckUp()
  32.         if not turtle.getItemCount() == 64 then
  33.             return false
  34.         end
  35.     end
  36.     return true
  37. end
  38.  
  39. function doCrafting()
  40.     -- get creosote oil
  41.     turtle.select(6)
  42.     safeSuck()
  43.  
  44.     turtle.select(SLOT_OUTPUT)
  45.     turtle.craft()
  46.     turtle.dropDown()
  47.  
  48.     turtle.select(6)
  49.     turtle.drop()
  50. end
  51.  
  52. intro()
  53. while getPlanks() do
  54.     for i = 1, 64 do
  55.         doCrafting()
  56.     end
  57. end
Add Comment
Please, Sign In to add comment