GamexLive

Untitled

Nov 27th, 2020 (edited)
711
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 fuelMaterial = turtle.getItemCount(1) -- Brennstoff
  4. local torch = turtle.getItemCount(2) -- Anzahl Fackeln
  5. local chests = turtle.getItemCount(3) --Anzahl Chests
  6. local placeBlock = turtle.getItemCount(4) -- Bloecke die platziert werden wenn unter der Turtle nichts ist
  7.  
  8. function ivFull()
  9.     local full = true
  10.         for i = 5,16 do
  11.             if turtle.getItemCount(i) == 0 then
  12.                 full = false
  13.             end
  14.         end
  15.     return full
  16. end
  17.  
  18.  
  19. function torchPlacement()
  20.     if torchDistance == 8 then
  21.             turtle.select(2)
  22.             turtle.turnRight()
  23.             turtle.turnRight()
  24.             turtle.place()
  25.             turtle.turnLeft()
  26.             turtle.turnLeft()
  27.             torchDistance = torchDistance - 8
  28.  
  29.     end
  30. end
  31.  
  32. function fuelLevel()
  33.     if turtle.getFuelLevel() < 100 then
  34.         turtle.refuel(1)
  35.         end
  36.     end
  37.  
  38. function mine()
  39.     fuelLevel()
  40.    
  41.     while ivFull() == false do
  42.  
  43.         if turtle.detectDown() == false then
  44.             turtle.select(3)
  45.             turtle.placeDown()
  46.         end
  47.  
  48.         if turtle.detect() then
  49.             turtle.dig()
  50.             turtle.forward()
  51.             turtle.digUp()
  52.             turtle.turnLeft()
  53.             turtle.dig()
  54.             turtle.up()
  55.             turtle.dig()
  56.             turtle.turnRight()
  57.             turtle.turnRight()
  58.             turtle.dig()
  59.             turtle.down()
  60.             turtle.dig()
  61.             turtle.turnLeft()
  62.             torchDistance = torchDistance + 1
  63.         else
  64.             turtle.forward()
  65.             torchDistance = torchDistance + 1
  66.         end
  67.        
  68.         torchPlacement()
  69.        
  70.     end
  71.     if chest > 0 then
  72.       turtle.select(2)
  73.       turtle.digDown()
  74.       turtle.placeDown()
  75.       chest = chest - 1
  76.          for slot = 5, 16 do
  77.            turtle.select(slot)
  78.            turtle.dropDown()
  79.            sleep(1.5)
  80.          end
  81.            turtle.select(5)
  82.    else
  83.      print("turtle run out of chest")
  84.       os.shutdown()
  85.    end
  86. end
  87.  
  88. function check()
  89. local error = 0
  90.  
  91. if torch == 0 then
  92.     print("Im Slot 2 fehlen Fackeln")
  93.     error = error + 1
  94.  
  95. else
  96.     print("Fackeln sind vorhanden")
  97. end
  98.  
  99. if fuelMaterial == 0 then
  100.     print("Im Slot 1 fehlt Brennstoff")
  101.     error = error + 1
  102. else
  103.     print("Brennbares Material vorhanden")
  104. end
  105.  
  106. if chests == 0 then
  107.         print("Es fehlen Kisten")
  108.         error = error + 1
  109.     else
  110.         print("Kisten vorhanden")
  111. end
  112.    
  113. if error == 0 then
  114.     return true
  115. else
  116.     return false
  117. end
  118.  
  119. end
  120.  
  121. function Start()
  122.     if check() == true then
  123.         mine()
  124.     else
  125.         print("Slots ueberpruefen")
  126.     end
  127. end
  128.  
  129. Start()
RAW Paste Data