Advertisement
Guest User

mine2

a guest
Jun 30th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
  2.   turtle.refuel()
  3. end
  4.  
  5. print("Enter the width, depth, and height in that order.")
  6.  
  7. local width = tonumber(read())
  8. local depth = tonumber(read())
  9. local height = tonumber(read())
  10.  
  11.   function mineforward ()
  12.     for i=1, width, 1 do
  13.       while turtle.detect() do
  14.         turtle.dig()
  15.         os.sleep(0.5)
  16.       end
  17.       turtle.forward()
  18.     end
  19.   end
  20.  
  21. function invcheck ()
  22.   if turtle.getItemCount(16) > 1 then
  23.     return true
  24.   else
  25.     return false
  26.   end
  27. end
  28.  
  29. local count = 0
  30.  
  31.   if turtle.detect() then
  32.  
  33.     for i=1, depth, 1 do
  34.       while turtle.detect() do
  35.         turtle.dig()
  36.         os.sleep(0.5)
  37.       end
  38.  
  39.       turtle.forward()
  40.       turtle.turnRight()
  41.    
  42.       for i=0, height, 1 do
  43.      
  44.         mineforward()
  45.         turtle.digUp()
  46.         turtle.up()
  47.         turtle.turnLeft()
  48.         turtle.turnLeft()
  49.        
  50.       end
  51.      
  52.       if height % 2 == 0 then
  53.         turtle.down()
  54.         turtle.down()
  55.         turtle.turnRight()
  56.  
  57.       else
  58.         turtle.turnLeft()
  59.         turtle.turnLeft()
  60.         mineforward()
  61.         turtle.turnRight()
  62.        
  63.       end
  64.       count = count + 1
  65.       if invcheck() then
  66.         for i=0, count, 1 do
  67.           turtle.back()
  68.         end
  69.        
  70.         turtle.up()
  71.         turtle.back()
  72.        
  73.         for i=1, 16, 1 do
  74.           turtle.dropDown(i)
  75.         end
  76.        
  77.         turtle.forward()
  78.         turtle.down()
  79.        
  80.         for i=0, count, 1 do
  81.           turtle.forward()
  82.         end
  83.       end
  84.     end
  85.   else
  86.     print("Place me in front of a block!")
  87.   end
  88. --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement