Advertisement
Guest User

tunnelV2

a guest
Jun 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. function reFuel()
  2.   if turtle.getFuelLevel() <= 200 then
  3.     turtle.select(1)
  4.     turtle.refuel(1)
  5.   end
  6. end
  7. function backTrack()
  8.   turtle.turnLeft()
  9.   turtle.turnLeft()
  10.   repeat
  11.     local success, data = turtle.forward()
  12.     if success then
  13.     end
  14.   until not success  
  15. end
  16. function chestStore()
  17.   turtle.turnLeft()
  18.   turtle.turnLeft()
  19.   repeat
  20.    local success, fata = turtle.inspectDown()
  21.    if success then
  22.    end
  23.    turtle.forward()  
  24.   until fata.name=="IronChest:BlockIronChest"
  25.   turtle.back()
  26.   for i=3,16 do
  27.     turtle.select(i)
  28.     turtle.dropDown()
  29.   end
  30.   turtle.turnLeft()
  31.   turtle.turnLeft()
  32.   repeat
  33.     turtle.forward()
  34.   until turtle.detect()
  35.   turtle.select(1)
  36. end
  37.  
  38. function tunnelV2(x)
  39.   for i = 1,x do
  40.     turtle.dig()
  41.     turtle.forward()
  42.     turtle.digUp()
  43.     turtle.turnLeft()
  44.     turtle.dig()
  45.     turtle.up()
  46.     turtle.dig()
  47.     turtle.turnRight()
  48.     turtle.turnRight()
  49.     turtle.dig()
  50.     turtle.down()
  51.     turtle.dig()
  52.     turtle.turnLeft()
  53.     reFuel()
  54.     if turtle.getItemCount(16) > 0 then
  55.       chestStore()
  56.     end
  57.    end
  58. backTrack()
  59. end
  60. local args={...}
  61. x=args[1]
  62. y=args[2]
  63. for i=1,y do
  64.   turtle.dig()
  65.   turtle.forward()
  66.   turtle.digUp()
  67.   if i%4==0 then
  68.     print("i is : ",i)
  69.     turtle.turnLeft()
  70.     tunnelV2(x)
  71.     i=i-1
  72.     turtle.turnLeft()
  73.   end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement