Advertisement
Slinger0001

Turtle Army

Dec 2nd, 2020 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.68 KB | None | 0 0
  1. --FjB3N2KX
  2. shell.run('clear')
  3. local Fuel = turtle.getFuelLevel()
  4. print("Current Fuel Level " ..Fuel)
  5. if Fuel<100 then
  6.     turtle.refuel()  
  7. else  
  8.     print("What do you want to do ?" ,"\n", "1.Tunnel", "\n", "2.Clear Space", "\n", "3.Defined Space")
  9.     local answer = io.read()
  10.  
  11.  
  12.     local counter=0
  13.     local direction = 0
  14.     local widthcount=0
  15.  
  16.  
  17.         if answer=="1" then
  18.  
  19.             while Fuel>0 do
  20.  
  21.                 turtle.dig()
  22.                 turtle.digUp()
  23.                 turtle.turnLeft()
  24.                 turtle.dig()
  25.                 turtle.up()
  26.                 turtle.dig()
  27.                 turtle.turnRight()
  28.                 turtle.turnRight()
  29.                 turtle.dig()
  30.                 turtle.down()
  31.                 turtle.dig()
  32.                 turtle.turnLeft()
  33.                 turtle.forward(1)
  34.  
  35.  
  36.                 Fuel = turtle.getFuelLevel()
  37.                 if Fuel<500 then
  38.                 turtle.refuel()
  39.                 else
  40.                 Fuel = turtle.getFuelLevel()
  41.  
  42.                 end
  43.             end
  44.         else
  45.         if answer=="2" then
  46.             while Fuel>0 do
  47.                 turtle.dig()
  48.                 turtle.forward(1)
  49.                 turtle.turnLeft()
  50.                 turtle.dig()
  51.                 turtle.digUp()
  52.                 turtle.up()
  53.                 turtle.dig()
  54.                 turtle.digUp()
  55.                 turtle.up()
  56.                 turtle.dig()
  57.                 turtle.turnRight()
  58.                 turtle.turnRight()
  59.                 turtle.dig()
  60.                 turtle.down()
  61.                 turtle.dig()
  62.                 turtle.down()
  63.                 turtle.dig()
  64.                 turtle.turnLeft()
  65.  
  66.                 Fuel = turtle.getFuelLevel()
  67.                 if Fuel<500 then
  68.                 turtle.refuel()
  69.                 else
  70.                 Fuel = turtle.getFuelLevel()
  71.  
  72.                 end
  73.             end
  74.  
  75.         else
  76.             if answer=="3" then
  77.                
  78.                     local countupheight = 0
  79.                     local countdownheight=0
  80.                     print("Enter length")
  81.                     local length = io.read()
  82.                     length = tonumber(length)
  83.                     print("Enter width")
  84.                     local width = io.read()
  85.                     width=tonumber(width)
  86.                     print("Enter height")
  87.                     local height = io.read()
  88.                     height=tonumber(height)
  89.                 if Fuel>0 then
  90.  
  91.                    
  92.                     while counter<length do
  93.                         turtle.dig()
  94.                         while countupheight<height do
  95.                             turtle.digUp()
  96.                             turtle.up()
  97.                             countupheight = countupheight+1
  98.                             print("up" .. countupheight)
  99.                         end  
  100.                         countdownheight=countupheight
  101.                         while countdownheight>0 do
  102.                             turtle.down()
  103.                             countdownheight=countdownheight-1    
  104.                             print("down" .. countdownheight)
  105.                         end  
  106.                         counter = counter+1
  107.                         countupheight=0
  108.                         countdownheight=0
  109.                         turtle.forward(1)
  110.                         if counter==length then
  111.                             if widthcount<width then
  112.                                 if direction==0 then
  113.                                     turtle.turnRight()
  114.                                     turtle.dig()
  115.                                     turtle.forward(1)
  116.                                     turtle.turnRight()
  117.                                     direction=1
  118.                                     counter=0
  119.                                     widthcount = widthcount+1
  120.                                 else
  121.                                     turtle.turnLeft()
  122.                                     turtle.dig()
  123.                                     turtle.forward()
  124.                                     turtle.turnLeft()
  125.                                     direction=0
  126.                                     counter=0
  127.                                     widthcount = widthcount+1
  128.                                 end
  129.                             end
  130.                         end
  131.                     end
  132.                 else
  133.                     Fuel = turtle.getFuelLevel()
  134.                     if Fuel<500 then
  135.                     turtle.refuel()
  136.                     else
  137.                     Fuel = turtle.getFuelLevel()
  138.                     end
  139.                 end
  140.             end
  141.         end
  142.     end
  143. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement