Advertisement
GamexLive

Untitled

Nov 27th, 2020
739
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 = torchDistance - 8
  31.        
  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.         print(torchDistance)
  76.     end
  77. end
  78.  
  79. function check()
  80. local fuel = turtle.getItemCount(1)
  81. local torch = turtle.getItemCount(2)
  82. local chest = turtle.getItemCount(4)
  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. else
  97.     print("Brennbares Material vorhanden")
  98. end
  99.  
  100. if chest == 0 then
  101.         print("Es fehlen Kisten")
  102.         error = error + 1
  103.     else
  104.         print("Kisten vorhanden")
  105. end
  106.    
  107. if error == 0 then
  108.     return true
  109. else
  110.     return false
  111. end
  112.  
  113. end
  114.  
  115. function Start()
  116.     if check() == true then
  117.         mine()
  118.     else
  119.         print("Slots ueberpruefen")
  120.     end
  121. end
  122.  
  123. Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement