Pr1smZ

Tunnelfun4.1t

Feb 6th, 2023
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | Gaming | 0 0
  1. function fuelLevel()
  2.  
  3.  if turtle.getFuelLevel() < 1000 then
  4.  
  5.   turtle.select(1)
  6.  
  7.   turtle.refuel(8)
  8.  
  9.   print("Refueled")
  10.  
  11.  else
  12.  
  13.   print("Enough Fuel")
  14.  
  15.  end
  16.  
  17. end
  18.  
  19.  
  20.  
  21. function mine()
  22.  
  23.  while turtle.detect() do
  24.  
  25.   turtle.dig()
  26.  
  27.   sleep(0.5)
  28.  
  29.  end
  30.  
  31.  turtle.forward()
  32.  
  33.  while turtle.detectUp() do
  34.  
  35.   turtle.digUp()
  36.  
  37.   sleep(0.5)
  38.  
  39.  end
  40.  
  41.  turtle.digDown()
  42.  
  43. end
  44.  
  45.  
  46.  
  47. function checkFull()
  48.  
  49.  if turtle.getItemCount(16) > 0 then
  50.  
  51.   turtle.back()
  52.  
  53.   turtle.down()
  54.  
  55.   turtle.digDown()
  56.  
  57.   turtle.select(3)
  58.  
  59.   turtle.placeDown()
  60.  
  61.   for i = 4,16 do
  62.  
  63.    turtle.select(i)
  64.  
  65.    turtle.dropDown()
  66.  
  67.   end
  68.  
  69.   turtle.select(2)
  70.  
  71.   turtle.up()
  72.  
  73.   turtle.forward()
  74.  
  75.  end
  76.  
  77. end
  78.  
  79.  
  80.  
  81. print("Place fuel in slot 1, torches in slot 2, and chests in slot 3!")
  82.  
  83. print("How wide will the tunnel be?")
  84.  
  85. local x = read()
  86.  
  87. print("How long will the tunnel be")
  88.  
  89. local y = read()
  90.  
  91. print("Wie oft wieder holen=")
  92.  
  93. local z = read()
  94.  
  95. local count = 1
  96. turtle.select(2)
  97.  
  98. turtle.placeDown()
  99. for i = 1, z do
  100.  
  101.  for i = 1, y do
  102.      
  103.    for i = 1, 1 do
  104.  
  105.     turtle.select(2)
  106.  
  107.     fuelLevel()
  108.  
  109.     checkFull()
  110.  
  111.     mine()
  112.  
  113.     turtle.turnLeft()
  114.  
  115.     for i = 1,((x/2)-0.5) do
  116.  
  117.      mine()
  118.  
  119.     end
  120.  
  121.     turtle.turnLeft()
  122.  
  123.     turtle.turnLeft()
  124.  
  125.     for i = 1,(x-1) do
  126.  
  127.      mine()
  128.  
  129.     end
  130.  
  131.     turtle.turnLeft()
  132.  
  133.     turtle.turnLeft()
  134.  
  135.     for i = 1,((x/2)-0.5) do
  136.  
  137.      turtle.forward()
  138.  
  139.     end
  140.  
  141.     turtle.turnRight()
  142.     if count % 8 == 0 then
  143.             turtle.select(2)
  144.             turtle.placeDown()
  145.      end
  146.    count = count + 1
  147.    end
  148.   end
  149.  
  150.  print( "Returning to start..." )
  151.  -- Return to where we started
  152.  for i = 1, y do
  153.      turtle.back()
  154.  end
  155. turtle.turnRight()
  156.  for i = 1, x do
  157.   mine()
  158.  end
  159. turtle.turnLeft()
  160. end
Advertisement
Add Comment
Please, Sign In to add comment