Advertisement
GamexLive

Untitled

Nov 27th, 2020
861
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. function chestPlacement()
  19.         if turtle.getItemCount(16)>0 then -- If slot 16 in turtle has item slot 5 to 16 will go to chest
  20.                     if chest > 0 then
  21.                         turtle.select(2)
  22.                         turtle.digDown()
  23.                         turtle.placeDown()
  24.                         chest = chest - 1
  25.                         for slot = 5, 16 do
  26.                             turtle.select(slot)
  27.                             turtle.dropDown()
  28.                             sleep(1.5)
  29.                         end
  30.                         turtle.select(5)
  31.                         mine()
  32.                     else
  33.                         print("turtle run out of chest")
  34.                         os.shutdown()
  35.                     end
  36.          end
  37. end
  38.  
  39. function torchPlacement()
  40.     if torchDistance == 8 then
  41.             turtle.select(2)
  42.             turtle.turnRight()
  43.             turtle.turnRight()
  44.             turtle.place()
  45.             turtle.turnLeft()
  46.             turtle.turnLeft()
  47.             torchDistance = torchDistance - 8
  48.  
  49.     end
  50. end
  51.  
  52. function fuelLevel()
  53.     if turtle.getFuelLevel() < 100 then
  54.         turtle.refuel(1)
  55.         end
  56.     end
  57.  
  58. function mine()
  59.     fuelLevel()
  60.    
  61.     while ivFull() == false do
  62.         if turtle.detect() then
  63.             turtle.dig()
  64.             turtle.forward()
  65.             turtle.digUp()
  66.             turtle.turnLeft()
  67.             turtle.dig()
  68.             turtle.up()
  69.             turtle.dig()
  70.             turtle.turnRight()
  71.             turtle.turnRight()
  72.             turtle.dig()
  73.             turtle.down()
  74.             turtle.dig()
  75.             turtle.turnLeft()
  76.             torchDistance = torchDistance + 1
  77.             torchPlacement()
  78.  
  79.         else
  80.             turtle.forward()
  81.             torchDistance = torchDistance + 1
  82.             torchPlacement()
  83.         end
  84.        
  85.         if turtle.detectDown() == false then
  86.            turtle.select(3)
  87.            turtle.placeDown()
  88.         end
  89.     end
  90.     chestPlacement()
  91. end
  92.  
  93. function check()
  94. local error = 0
  95.  
  96. if torch == 0 then
  97.     print("Im Slot 2 fehlen Fackeln")
  98.     error = error + 1
  99.  
  100. else
  101.     print("Fackeln sind vorhanden")
  102. end
  103.  
  104. if fuelMaterial == 0 then
  105.     print("Im Slot 1 fehlt Brennstoff")
  106.     error = error + 1
  107. else
  108.     print("Brennbares Material vorhanden")
  109. end
  110.  
  111. if chests == 0 then
  112.         print("Es fehlen Kisten")
  113.         error = error + 1
  114.     else
  115.         print("Kisten vorhanden")
  116. end
  117.    
  118. if error == 0 then
  119.     return true
  120. else
  121.     return false
  122. end
  123.  
  124. end
  125.  
  126. function Start()
  127.     if check() == true then
  128.         mine()
  129.     else
  130.         print("Slots ueberpruefen")
  131.     end
  132. end
  133.  
  134. Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement