Advertisement
GamexLive

Untitled

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