SHARE
TWEET

Mine

a guest Jul 24th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("How many branches?")
  2. local input = read()
  3. local output = input-1
  4.  
  5. function math()
  6. local reqfuel = (input*30.4)
  7.  
  8. print("Current Fuel is: ",turtle.getFuelLevel())
  9. print("Required fuel is ",reqfuel)
  10. print("Proceed? Y/N")
  11. proceed = read()
  12.  
  13. end
  14.  
  15. function tunnel()
  16.  
  17.   for i=1,10 do
  18.   while turtle.detect() do
  19.   turtle.dig()
  20.   end
  21.   turtle.forward()
  22.   turtle.digDown()
  23.  end
  24.  
  25.  turtle.turnLeft()
  26.  turtle.turnLeft()
  27.  turtle.down()
  28.  
  29.  if turtle.detectDown() == true then
  30.  turtle.up()
  31.  turtle.select(16)
  32.  turtle.placeDown()
  33.  else
  34.  turtle.select(15)
  35.  turtle.placeDown()
  36.  turtle.up()
  37.  turtle.select(16)
  38.  turtle.placeDown()
  39.  end
  40.  
  41.  for i=1,10 do
  42.  turtle.forward()
  43.  end
  44.  
  45.  turtle.turnLeft()
  46.  
  47.  for i=1,3 do
  48.   while turtle.detect() do
  49.   turtle.dig()
  50.   end
  51.   turtle.forward()
  52.   turtle.digDown()
  53.  end
  54.  
  55.  turtle.turnLeft()
  56.  
  57. end
  58.  
  59. function refuel()
  60.  for i=1,13 do
  61.   turtle.select(i)
  62.   turtle.refuel()
  63.  end
  64. end
  65.  
  66. function home()
  67.  turtle.turnLeft()
  68.  local bal = 1
  69.  for i=1,input do
  70.   turtle.down()
  71.   if turtle.detectDown() == true then
  72.    turtle.up()
  73.    turtle.select(16)
  74.    if bal == 1 then
  75.     turtle.placeDown()
  76.     bal = 2
  77.    elseif bal == 2 then
  78.     bal = 3
  79.    else
  80.     bal = 1
  81.     end  
  82.   else
  83.    turtle.select(15)
  84.    turtle.placeDown()
  85.    turtle.up()
  86.    turtle.select(16)
  87.    if bal == 1 then
  88.    turtle.placeDown()
  89.    bal = 2
  90.    elseif bal == 2 then
  91.    bal = 3
  92.    else
  93.    bal =1
  94.    end
  95.    
  96.   end    
  97.   turtle.forward()
  98.   turtle.forward()
  99.   turtle.forward()
  100.  end
  101.  turtle.turnLeft()
  102.  turtle.forward()
  103. turtle.select(14)
  104. turtle.placeDown()
  105.   for i=1,13 do
  106.   turtle.select(i)
  107.   turtle.dropDown()
  108.  end
  109.  turtle.turnLeft()
  110.  turtle.turnLeft()
  111.  turtle.forward()
  112.  turtle.down()
  113. end
  114.  
  115. math()
  116. if proceed == "Y" then
  117.  
  118. turtle.up()
  119. for i=1,input do
  120. tunnel()
  121. end
  122. home()
  123.  
  124. else
  125. refuel()
  126. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top