Advertisement
Guest User

quarry.lua

a guest
Jan 20th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. local chunksize = 16
  2. local start_height = 64
  3. local stop_height = 12
  4.  
  5. function digForward()
  6.     while true do
  7.         if turtle.forward() then
  8.             break
  9.         else
  10.             turtle.dig()
  11.             turtle.attack()
  12.         end
  13.     end
  14. end
  15.  
  16. function slice()
  17.     for i=0,chunksize-2 do
  18.         digForward()
  19.     end
  20. end
  21.  
  22. function emptyInv()
  23.     for i=1,15 do
  24.         turtle.select(i)
  25.         turtle.drop(turtle.getItemCount(i))
  26.     end
  27.     turtle.select(1)
  28. end
  29. local current_height = start_height;
  30. for i=stop_height,start_height do
  31.    
  32.  
  33.     print("remove flat")
  34.     for i=0,6 do
  35.         slice()
  36.  
  37.         turtle.turnRight()
  38.         digForward()
  39.         turtle.turnRight()
  40.         slice()
  41.  
  42.         turtle.turnLeft()
  43.         digForward()
  44.         turtle.turnLeft()
  45.     end
  46.  
  47.     slice()
  48.  
  49.     turtle.turnRight()
  50.     digForward()
  51.     turtle.turnRight()
  52.     slice()
  53.  
  54.     --back to start
  55.     print("back to start")
  56.  
  57.     turtle.turnRight()
  58.     slice()
  59.    
  60.    
  61.     while true do
  62.         print("start empty")
  63.         if current_height == start_height then
  64.             turtle.turnLeft()
  65.             emptyInv()
  66.             turtle.turnLeft()
  67.             turtle.turnLeft()
  68.            
  69.             while turtle.down() == true do
  70.                 turtle.down()
  71.                 current_height = current_height - 1;
  72.             end
  73.             turtle.digDown()
  74.             turtle.down()
  75.             break
  76.         else
  77.             turtle.up()
  78.             current_height = current_height + 1;
  79.         end
  80.     end
  81.  
  82.     current_height = current_height - 1
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement