Advertisement
terryhelloworld

Untitled

Jun 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. --[[
  2. terraform flattens land
  3. ]]--
  4.  
  5. X_SIZE = 3
  6. Z_SIZE = 3
  7.  
  8. FUEL_SLOT = 1
  9.  
  10. function checkFuel()
  11. if turtle.getFuelLevel() < 80 then
  12. print("Refueling...")
  13. turtle.select(FUEL_SLOT)
  14. turtle.refuel(1)
  15. end
  16. end
  17.  
  18. function dig()
  19. checkFuel()
  20.  
  21. while turtle.detect() do
  22. print("Digging")
  23. turtle.dig()
  24. end
  25. end
  26.  
  27. function clearBlock()
  28. y = 0
  29. dig()
  30. turtle.forward()
  31. while turtle.detectUp() do
  32. print("Found block above, going up")
  33. y = y + 1
  34. turtle.digUp()
  35. turtle.up()
  36. end
  37.  
  38. print("Coming back down")
  39. for i = 0, y do
  40. turtle.down()
  41. end
  42. end
  43.  
  44. function clearRow()
  45. for z = 1, Z_SIZE do
  46. print("Clear row", z)
  47. clearBlock()
  48. end
  49. end
  50.  
  51. x = 1
  52. repeat
  53. clearRow()
  54. turtle.turnRight()
  55. clearBlock()
  56. turtle.turnRight()
  57. clearRow()
  58. turtle.turnLeft()
  59. clearBlock()
  60. turtle.turnLeft()
  61. until x >= X_SIZE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement