Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. local fuel = 0
  2.  
  3. term.write("Length? ")
  4. local length = tonumber(read())
  5.  
  6. function fforward()
  7. while (turtle.forward() == false) do
  8. turtle.dig()
  9. sleep(0.4)
  10. end
  11. fuel = fuel + 1
  12. end
  13.  
  14. function Chest()
  15. if (turtle.getItemCount(15) >= 1) then
  16. turtle.turnRight()
  17. turtle.turnRight()
  18. turtle.select(16)
  19. turtle.place()
  20. for i = 1, 15 do
  21. turtle.select(b)
  22. turtle.drop()
  23. b = b + 1
  24. end
  25. turtle.select(1)
  26. turtle.turnRight()
  27. turtle.turnRight()
  28. end
  29. b = 1
  30. end
  31.  
  32. function Unit1()
  33. turtle.turnRight()
  34. turtle.dig()
  35. turtle.turnRight()
  36. turtle.turnRight()
  37. turtle.dig()
  38. turtle.turnRight()
  39. end
  40.  
  41. function Unit2()
  42. for i = 1, length do
  43. if (i % 2 == 1) then do
  44. for j = 1, 2 do
  45. Chest()
  46. Unit1()
  47. turtle.digUp()
  48. turtle.up()
  49. fuel = fuel + 1
  50. end
  51. Unit1()
  52. fforward()
  53. end
  54. else
  55. for j = 1, 2 do
  56. Chest()
  57. Unit1()
  58. turtle.digDown()
  59. turtle.down()
  60. fuel = fuel + 1
  61. end
  62. Unit1()
  63. fforward()
  64. end
  65. end
  66. end
  67.  
  68. Unit2()
  69. print("Energy used: ")
  70. term.write(fuel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement