edoreld

Untitled

Mar 1st, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local tArgs = {...}
  2. local branchesToMine = tonumber(tArgs[1])
  3. local maximumMineableSlot = 15
  4. local torchSlot = 16
  5.  
  6. if #tArgs < 1 then
  7. branchesToMine = 1
  8. print(" Defaulting to 1 branches to mine")
  9. end
  10.  
  11. function fuel()
  12. while turtle.getFuelLevel() < 1000 do
  13. for i=1, 16 do
  14. turtle.select(i)
  15. turtle.refuel()
  16. end
  17. if turtle.getFuelLevel() < 1000 then
  18. write ("Please enter fuel manually")
  19. os.sleep(5)
  20. end
  21. end
  22. end
  23.  
  24. function minebranch()
  25. for i = 1, 16 do
  26. fuel()
  27. turtle.dig()
  28. turtle.digUp()
  29. turtle.digDown()
  30. if i % 4 == 0 then
  31. turtle.select(torchSlot)
  32. turtle.placeDown()
  33. turtle.select(1)
  34. end
  35. turtle.turnLeft()
  36. turtle.dig()
  37. for i = 1, 2 do
  38. turtle.turnRight()
  39. end
  40. turtle.dig()
  41. turtle.turnLeft()
  42. turtle.dig()
  43. turtle.forward()
  44. end
  45. end
  46.  
  47. function goBack()
  48. for i = 1, 2 do
  49. turtle.turnLeft()
  50. end
  51.  
  52. for i = 1, 16 do
  53. fuel()
  54. while not turtle.forward() do
  55. turtle.dig()
  56. end
  57. end
  58.  
  59. for i = 1, 2 do
  60. turtle.turnLeft()
  61. end
  62. end
  63.  
  64. function nextBranch()
  65. turtle.turnRight()
  66. for i = 1, 5 do
  67. fuel()
  68. while not turtle.forward() do
  69. turtle.dig()
  70. end
  71. end
  72. turtle.turnLeft()
  73. end
  74.  
  75.  
  76. for i = 1, branchesToMine do
  77. minebranch()
  78. goBack()
  79. nextBranch()
  80. end
Advertisement
Add Comment
Please, Sign In to add comment