superjaja05

Untitled

Sep 14th, 2021 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. local args = {...}
  2.  
  3. if args[1] == nil then
  4. print("Usage: minertunnel <length> <height(2-3)> <width(1-3)> <bridge (true/false)>")
  5. return
  6. end
  7.  
  8. function search()
  9. print("Initalizing search for blocks")
  10. slot1 = 1
  11. done1 = false
  12. repeat
  13. print("Searching slot "..slot1)
  14. if turtle.getItemDetail(slot1) ~= nil then
  15. turtle.select(slot1)
  16. turtle.transferTo(1)
  17. turtle.select(1)
  18. break
  19. else
  20. slot1 = slot1+1
  21. end
  22. if slot1 == 16 and turtle.getItemDetail(16) == nil then
  23. os.sleep(2)
  24. textutils.slowPrint("Not found.. rebooting")
  25. os.reboot()
  26. end
  27. until done1 == true
  28. end
  29.  
  30. local length = tonumber(args[1])
  31. local height = tonumber(args[2])
  32. local width = tonumber(args[3])
  33. local bridge1 = args[4]
  34.  
  35.  
  36. print("Tunnel Miner started!")
  37. print("Parameters:")
  38. print("Length:"..length)
  39. print("Height:"..height)
  40. print("Width:"..width)
  41. print("Bridge:"..bridge1)
  42.  
  43. os.sleep(0.25)
  44.  
  45. i = 0
  46. repeat
  47. i = i+1
  48. turtle.dig()
  49. turtle.forward()
  50. if bridge1 == "true" and height < 3 then
  51. if turtle.getItemDetail() == nil then
  52. search()
  53. turtle.placeDown()
  54. else
  55. turtle.placeDown()
  56. end
  57. end
  58. turtle.digUp()
  59. if height == 3 then
  60. turtle.digDown()
  61. if bridge1 == "true" then
  62. turtle.down()
  63. if turtle.getItemDetail() == nil then
  64. search()
  65. turtle.placeDown()
  66. else
  67. turtle.placeDown()
  68. end
  69. turtle.up()
  70. end
  71. end
  72. if width > 1 then
  73. if width > 1 then
  74. turtle.turnRight()
  75. turtle.dig()
  76. turtle.forward()
  77. turtle.digUp()
  78. if height == 3 then
  79. turtle.digDown()
  80. end
  81. turtle.back()
  82. turtle.turnLeft()
  83. end
  84. if width > 2 then
  85. turtle.turnLeft()
  86. turtle.dig()
  87. turtle.forward()
  88. turtle.digUp()
  89. if height == 3 then
  90. turtle.digDown()
  91. end
  92. turtle.back()
  93. turtle.turnRight()
  94. end
  95. end
  96. until i == length
  97.  
  98. i1 = 0
  99. repeat
  100. turtle.back()
  101. i1 = i1+1
  102. until i1 == length
  103.  
  104. turtle.down()
  105.  
  106. print("Restart with same parameters? (to the right) (y/n)")
  107.  
  108. result = io.read()
  109.  
  110. if result == "y" then
  111. turtle.turnRight()
  112. turtle.up()
  113. turtle.forward()
  114. turtle.forward()
  115. turtle.forward()
  116. turtle.turnLeft()
  117. shell.run("minertunnel", args[1], args[2], args[3])
  118. end
  119.  
Add Comment
Please, Sign In to add comment