NicoReimer

Strip

Feb 8th, 2021 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.19 KB | None | 0 0
  1. local laenge = 8
  2. local error = false
  3. local leeehr = false
  4.  
  5. function leehr()
  6.    
  7.     turtle.turnLeft()
  8.     turtle.turnLeft()
  9.  
  10.     if turtle.detect() then
  11.         turtle.dig()
  12.     end
  13.    
  14.     turtle.select(1)
  15.  
  16.     if turtle.place() then
  17.  
  18.         for i = 4, 16, 1 do
  19.             turtle.select(i)
  20.             turtle.drop()
  21.         end
  22.    
  23.     else
  24.         error = true
  25.     end
  26.  
  27.     turtle.select(1)
  28.     turtle.dig()
  29.     turtle.turnLeft()
  30.     turtle.turnLeft()
  31.  
  32. end
  33.  
  34. function entleehr()
  35.    
  36.     if turtle.getItemCount(14) > 0 then
  37.         leehr()
  38.     end
  39.  
  40. end
  41.  
  42. function nachVorne()
  43.    
  44.     for i = 1, 3, 1 do
  45.         if turtle.detect() then
  46.             turtle.dig()
  47.             entleehr()
  48.         end
  49.         turtle.forward()
  50.  
  51.         if turtle.detectUp() then
  52.             turtle.digUp()
  53.             entleehr()
  54.         end
  55.     end
  56.  
  57. end
  58.  
  59. function gang()
  60.  
  61.     for i = 1, laenge, 1 do
  62.         if turtle.detect() then
  63.             turtle.dig()
  64.             entleehr()
  65.         end
  66.         turtle.forward()
  67.    
  68.         if turtle.detectUp() then
  69.             turtle.digUp()
  70.             entleehr()
  71.         end
  72.     end
  73.  
  74.     turtle.select(3)
  75.     turtle.placeUp()
  76.     turtle.select(1)
  77.  
  78.     turtle.turnLeft()
  79.     turtle.turnLeft()
  80.  
  81.     for i = 1, laenge, 1 do
  82.         if turtle.detect() then
  83.             turtle.dig()
  84.             entleehr()
  85.         end
  86.         turtle.forward()
  87.     end
  88.  
  89. end
  90.  
  91. print("Wie viele Wege?")
  92.  
  93. local anz = io.read("*l")
  94.  
  95. if turtle.getFuelLevel() == 0 then
  96.    
  97.     local anzKohle = turtle.getItemCount(2)
  98.  
  99.     if anzKohle < 2 then
  100.  
  101.         leeehr = true
  102.  
  103.     else
  104.    
  105.         turtle.select(2)
  106.         turtle.refuel(anzKohle - 1)
  107.         turtle.select(1)
  108.  
  109.     end
  110.  
  111. end
  112.  
  113. if leeehr == false then
  114.  
  115.     for i = 1, anz, 1 do
  116.  
  117.         nachVorne()
  118.         turtle.turnLeft()
  119.         gang()
  120.         gang()
  121.         turtle.turnRight()
  122.  
  123.     end
  124.  
  125.     turtle.turnLeft()
  126.     turtle.turnLeft()
  127.  
  128.     for i = 1, (anz * 3) + 1, 1 do
  129.  
  130.         if turtle.detect() then
  131.             turtle.dig()
  132.             entleehr()
  133.         end
  134.         turtle.forward()
  135.  
  136.     end
  137.  
  138. else
  139.  
  140.     print("ERROR: not genug fuel")
  141.  
  142. end
Add Comment
Please, Sign In to add comment