Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. local torch = turtle.getItemCount(1)
  2. local dist = 0
  3.  
  4. function digforw()
  5. if turtle.detect() then
  6. turtle.dig()
  7. end
  8. turtle.forward()
  9. dump()
  10. turtle.digUp()
  11. dump()
  12. dist = dist + 1
  13. end
  14.  
  15. function digforl()
  16. turtle.turnLeft()
  17. turtle.up()
  18. for i=1,6,1 do
  19. if turtle.detect() then
  20. turtle.dig()
  21. end
  22. turtle.forward()
  23. end
  24. turtle.turnLeft()
  25. turtle.turnLeft()
  26. for i=1,7,1 do
  27. turtle.forward()
  28. end
  29. turtle.down()
  30. turtle.turnLeft()
  31. end
  32.  
  33. function digforr()
  34. turtle.turnRight()
  35. turtle.up()
  36. for i=1,6,1 do
  37. if turtle.detect() then
  38. turtle.dig()
  39. end
  40. turtle.forward()
  41. end
  42. turtle.turnLeft()
  43. turtle.turnLeft()
  44. for i=1,7,1 do
  45. turtle.forward()
  46. end
  47. turtle.down()
  48. turtle.turnRight()
  49. end
  50.  
  51. local fuel = turtle.getFuelLevel()
  52. function run()
  53. if fuel < 1 then
  54. for i = 2, 16 do -- loop through the slots
  55. turtle.select(i) -- change to the slot
  56. if turtle.refuel(0) then -- if it's valid fuel
  57. local halfStack = math.ceil(turtle.getItemCount(i)/2) -- work out half of the amount of fuel in the slot
  58. turtle.refuel(halfStack) -- consume half the stack as fuel
  59. end
  60. end
  61. end
  62. turtle.select(1)
  63. digforw()
  64. digforw()
  65. digforw()
  66. digforw()
  67. digforw()
  68. digforw()
  69. digforw()
  70. digforw()
  71. digforw()
  72. digforw()
  73. print("dig-l")
  74. digforl()
  75. end
  76.  
  77. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement