GamexLive

Untitled

Nov 27th, 2020
804
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.  
  72. end
  73.  
  74. function check()
  75. local error = 0
  76.  
  77. if torch == 0 then
  78.     print("Im Slot 2 fehlen Fackeln")
  79.     error = error + 1
  80.  
  81. else
  82.     print("Fackeln sind vorhanden")
  83. end
  84.  
  85. if fuelMaterial == 0 then
  86.     print("Im Slot 1 fehlt Brennstoff")
  87.     error = error + 1
  88. else
  89.     print("Brennbares Material vorhanden")
  90. end
  91.  
  92. if chests == 0 then
  93.         print("Es fehlen Kisten")
  94.         error = error + 1
  95.     else
  96.         print("Kisten 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()
RAW Paste Data