Guest User

TurtleProgramm

a guest
Nov 27th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. local torchDistance = 0
  2. local fuelLevel = turtle.getFuelLevel()
  3. local chests = turtle.getItemCount(4)
  4.  
  5. function ivFull()
  6. local full = true
  7. for i = 4,16 do
  8. if turtle.getItemCount(i) == 0 then
  9. full = false
  10. end
  11. end
  12. return full
  13. end
  14.  
  15. function mine()
  16. if turtle.getFuelLevel() > 100 then
  17. else
  18. turtle.refuel(1)
  19. end
  20.  
  21. while ivFull() == false do
  22.  
  23. if torchDistance == 8 then
  24.  
  25. turtle.select(2)
  26. turtle.turnRight()
  27. turtle.turnRight()
  28. turtle.place()
  29. turtle.turnLeft()
  30. turtle.turnLeft()
  31. torchDistance = 0
  32. end
  33.  
  34. if turtle.detectDown() == false then
  35. turtle.select(3)
  36. turtle.placeDown()
  37. end
  38.  
  39. if turtle.detect() then
  40. turtle.dig()
  41. turtle.forward()
  42. turtle.digUp()
  43. turtle.turnLeft()
  44. turtle.dig()
  45. turtle.up()
  46. turtle.dig()
  47. turtle.turnRight()
  48. turtle.turnRight()
  49. turtle.dig()
  50. turtle.down()
  51. turtle.dig()
  52. turtle.turnLeft()
  53. torchDistance = torchDistance + 1
  54. else
  55. turtle.forward()
  56. torchDistance = torchDistance + 1
  57. end
  58.  
  59. if ivFull() == true then
  60. if chests > 0 then
  61. turtle.select(4)
  62. turtle.digDown()
  63. turtle.placeDown()
  64. chest = chest - 1
  65. for slot = 5,16 do
  66. turtle.select(slot)
  67. turtle.dropDown()
  68. sleep(1.5)
  69. end
  70. turtle.select(5)
  71. else
  72. print("Keine Kisten vorhanden")
  73. os.shutdown()
  74. end
  75. end
  76. end
  77.  
  78. end
  79.  
  80. function check()
  81. local torch = turtle.getItemCount(2)
  82. local fuel = turtle.getItemCount(1)
  83. local error = 0
  84.  
  85. if torch == 0 then
  86. print("Im Slot 2 fehlen Fackeln")
  87. error = error + 1
  88.  
  89. else
  90. print("Fackeln sind vorhanden")
  91. end
  92.  
  93. if fuel == 0 then
  94. print("Es fehlt brennbares Material")
  95. error = error + 1
  96.  
  97. else
  98. print("Brennbares Material vorhanden")
  99. end
  100. if error == 0 then
  101. return true
  102. else
  103. return false
  104. end
  105. end
  106. function Start()
  107. if check() == true then
  108. mine()
  109. else
  110. print("Slots ueberpruefen")
  111. end
  112. end
  113. check()
  114. Start()
Advertisement
Add Comment
Please, Sign In to add comment