Advertisement
Guest User

Untitled

a guest
Mar 8th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1.  
  2.  
  3.  
  4. function dig()
  5.     repeat turtle.dig() until not turtle.detect()
  6. end
  7.  
  8. function forward()
  9.     repeat until turtle.forward()
  10. end
  11.  
  12. function up()
  13.     repeat until turtle.up()
  14. end
  15.  
  16. function down()
  17.     repeat until turtle.down()
  18. end
  19.  
  20.  
  21.  
  22.  
  23. function slice()
  24.     dig()
  25.     forward()    
  26.     turtle.turnLeft()
  27.     dig()
  28.     turtle.digUp()
  29.     up()
  30.     dig()
  31.     turtle.digUp()
  32.     up()
  33.     dig()
  34.     turtle.turnRight()
  35.     turtle.turnRight()
  36.     dig()
  37.     down()
  38.     dig()
  39.     down()
  40.     dig()
  41.     turtle.turnLeft()
  42. end
  43.  
  44. function goBack(dist)
  45.     for i=1,dist do
  46.         turtle.forward()
  47.     end
  48. end
  49.  
  50. function refuel()
  51.     for i=1,16 do
  52.         turtle.select(i)
  53.         turtle.refuel(64)
  54.     end
  55. end
  56.  
  57.  
  58. write("Distance:")
  59. local a=0
  60. a=read()
  61.  
  62. for i=1,a do
  63.     slice()
  64.     while turtle.getFuelLevel() < a*5 do
  65.         print("waiting for fuel...")
  66.         refuel()
  67.     end
  68. end
  69.     turtle.turnLeft()
  70.     turtle.turnLeft()
  71.     goBack(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement