overshoot

Multi Branch Mining Turtle v2 scU06pu2

Jun 26th, 2019 (edited)
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. print("Turtle Multiple Branch Mine v2 190629")
  2.  
  3. print("Name: ", os.getComputerLabel() )
  4. print("Fuel Level: ", turtle.getFuelLevel())
  5. print("scU06pu2")
  6.  
  7. function DigUp()
  8. print("Up")
  9. while turtle.detectUp()
  10. do turtle.digUp()
  11. sleep(0.4)
  12. end
  13. turtle.up()
  14. end --of DigUp
  15.  
  16. -- Dig Foward
  17. function DigFwd()
  18. print("Forward")
  19. while turtle.detect() do
  20. turtle.dig()
  21. sleep(0.4)
  22. end
  23. turtle.forward()
  24. end -- of Dig Fwd
  25.  
  26. -- DigDwn
  27. function DigDwn()
  28. print("Down")
  29. while turtle.detectDown()
  30. do turtle.digDown() end
  31. turtle.down()
  32. end -- of DigDown
  33.  
  34. -- Place torch
  35. function PlaceTorch()
  36. print("Place Torch")
  37. turtle.back()
  38. turtle.back()
  39. turtle.turnRight()
  40. turtle.select(16)
  41. turtle.placeUp()
  42. turtle.turnLeft()
  43. turtle.forward()
  44. turtle.forward()
  45. end -- of PlaceTorch
  46.  
  47. -- Dig a Segment and place torch
  48. function DigSegment(Length)
  49. for i=1,Length,1 do
  50. DigFwd()
  51. DigUp()
  52. DigFwd()
  53. DigDwn()
  54. end -- for loop for dig cycle
  55. end -- DigSegment function
  56.  
  57. -- Turn Back
  58. function TurnBack()
  59. turtle.turnLeft()
  60. DigFwd()
  61. DigUp()
  62. DigFwd()
  63. DigDwn()
  64. DigFwd()
  65. DigUp()
  66. turtle.down()
  67. PlaceTorch()
  68. turtle.turnLeft()
  69. end
  70. -- End Turn Back function
  71.  
  72. -- Start Another Branch
  73. function StartAnotherBranch()
  74. turtle.turnRight()
  75. turtle.forward()
  76. turtle.select(15)
  77. turtle.turnLeft()
  78. turtle.place()
  79.  
  80. if turtle.detect()
  81. then
  82. for slot=1,14,1 do
  83. turtle.select(slot)
  84. turtle.drop()
  85. end -- for each slot in inventory
  86. end -- If chest placed
  87.  
  88. turtle.turnRight()
  89. turtle.forward()
  90. turtle.forward()
  91. turtle.turnRight()
  92. end -- function StartAnotherBranch
  93.  
  94. ---------------------------
  95. -- Main Program
  96. NumSeg=10 -- Number of segments before turning back
  97. SegLen=4 -- Length of Segment between Torches
  98. NumBranch=4 -- Number of Branches to Mine
  99.  
  100. for branch=1,NumBranch,1 do
  101. for seg=1,NumSeg,1 do
  102. DigSegment(SegLen)
  103. PlaceTorch()
  104. end -- Distance to dig forward
  105.  
  106. TurnBack()
  107.  
  108. for seg=1,NumSeg,1 do
  109. DigSegment(SegLen)
  110. PlaceTorch()
  111. end -- Distance to dig back toward start
  112.  
  113. StartAnotherBranch()
  114. end -- for each branch to mine
Advertisement
Add Comment
Please, Sign In to add comment