SmashBro

Clear Area

Apr 27th, 2020
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. local length = 0
  2. local width = 0
  3.  
  4. turtle.select(1)
  5. print("How long do you want the tunnel?")
  6. length = io.read()
  7. print("How wide do you want the tunnel?")
  8. width = io.read()
  9. length = tonumber(length)
  10. width = tonumber(width)
  11.  
  12. for h=1, width do
  13. for i=1, length-2 do
  14. if i < length then
  15. turtle.dig()
  16. turtle.forward()
  17. end
  18.  
  19. if turtle.detectUp() then
  20. turtle.digUp()
  21. end
  22.  
  23. if turtle.detectDown() then
  24. turtle.digDown()
  25. end
  26.  
  27. if (turtle.getItemCount(16) >= 1) then --Drop items into a chest
  28. turtle.select(3)
  29. turtle.placeDown()
  30. for slot=4, 16 do
  31. turtle.select(slot)
  32. turtle.dropDown()
  33. end
  34. turtle.select(1)
  35. end
  36.  
  37. if (h==1 or h%4==0) then --Place a torch
  38. if i%8==0 then
  39. turtle.select(2)
  40. turtle.placeDown()
  41. turtle.select(1)
  42. end
  43. end
  44.  
  45. if (turtle.getFuelLevel() <= 1) then
  46. turtle.refuel(1)
  47. end
  48.  
  49. end
  50.  
  51. turtle.dig()
  52. turtle.forward()
  53. turtle.digUp()
  54. turtle.digDown()
  55.  
  56. if h%2==0 then
  57. turtle.turnLeft()
  58. else
  59. turtle.turnRight()
  60. end
  61.  
  62. turtle.dig()
  63. turtle.forward()
  64. turtle.digUp()
  65. turtle.digDown()
  66.  
  67. if h%2==0 then
  68. turtle.turnLeft()
  69. else
  70. turtle.turnRight()
  71. end
  72.  
  73. turtle.dig()
  74. turtle.forward()
  75. turtle.digUp()
  76. turtle.digDown()
  77.  
  78. end
Add Comment
Please, Sign In to add comment