GamexLive

Untitled

Nov 27th, 2020 (edited)
889
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 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 = 0
  28.     end
  29. end
  30.  
  31. function fuelLevel()
  32.     if turtle.getFuelLevel() < 100 then
  33.         turtle.refuel(1)
  34.         end
  35.     end
  36.  
  37. function mine()
  38.     fuelLevel()
  39.    
  40.     while ivFull() == false do
  41.  
  42.         if turtle.detect() == true then
  43.             turtle.dig()
  44.             turtle.forward()
  45.             turtle.digUp()
  46.             turtle.turnLeft()
  47.             turtle.dig()
  48.             turtle.up()
  49.             turtle.dig()
  50.             turtle.turnRight()
  51.             turtle.turnRight()
  52.             turtle.dig()
  53.             turtle.down()
  54.             turtle.dig()
  55.             turtle.turnLeft()
  56.         else
  57.             turtle.forward()
  58.         end
  59.         torchDistance = torchDistance + 1
  60.         torchPlacement()    
  61.     end
  62.  
  63.     if turtle.detectDown() == false then
  64.         turtle.down()
  65.         turtle.digDown()
  66.         turtle.select(3)
  67.         turtle.placeDown();
  68.         for i = 5,16 do
  69.             turtle.dropDown(i)
  70.         end
  71.     Start()
  72.     end
  73. end
  74.  
  75. function check()
  76. local error = 0
  77.  
  78. if torch == 0 then
  79.     print("Im Slot 2 fehlen Fackeln")
  80.     error = error + 1
  81.  
  82. else
  83.     print("Fackeln sind vorhanden")
  84. end
  85.  
  86. if fuelMaterial == 0 then
  87.     print("Im Slot 1 fehlt Brennstoff")
  88.     error = error + 1
  89. else
  90.     print("Brennbares Material vorhanden")
  91. end
  92.  
  93. if chests == 0 then
  94.         print("Es fehlen Kisten")
  95.         error = error + 1
  96.     else
  97.         print("Kisten vorhanden")
  98. end
  99.    
  100. if error == 0 then
  101.     return true
  102. else
  103.     return false
  104. end
  105.  
  106. end
  107.  
  108. function Start()
  109.     if check() == true then
  110.         mine()
  111.     else
  112.         print("Slots ueberpruefen")
  113.     end
  114. end
  115.  
  116. Start()
Add Comment
Please, Sign In to add comment