GusGold

MineTunnel

Feb 1st, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. lenght = 196
  2. fuelSlot = 1
  3. buildSlot = 2
  4. cobbleSlot = buildSlot
  5. y = 0
  6. level = 0
  7. turnBuild = "turn"
  8.  
  9. function refuel()
  10.     turtle.select(fuelSlot)
  11.     if turtle.getFuelLevel() < 1 then
  12.         turtle.refuel(1)
  13.         print("Refueled")
  14.     end
  15. end
  16.  
  17. function height()
  18.     refuel()
  19.     if level == 0 then
  20.         while turtle.detectUp() == true do
  21.             turtle.digUp()
  22.         end
  23.         turtle.Up()
  24.         level = 1
  25.     else
  26.         while turtle.detectDown() == true do
  27.             turtle.digDown()
  28.         end
  29.         turtle.Down()
  30.         level = 0
  31.     end
  32. end
  33.  
  34. function build()
  35.     if level == 0 then
  36.         turtle.buildDown()
  37.     else
  38.         turtle.buildUp()
  39.     end
  40. end
  41.  
  42. function move()
  43.     refuel()
  44.     while turtle.detect() == true do
  45.         turtle.dig()
  46.     end
  47.     turtle.forward()
  48. end
  49.  
  50. function seal()
  51.     turtle.turnLeft()
  52.     turtle.build()
  53.     turtle.turnRight()
  54.     build()
  55.     turtle.turnRight()
  56.     turtle.build()
  57.     height()
  58.     turtle.build()
  59.     turtle.turnLeft()
  60.     build()
  61.     turtle.turnLeft()
  62.     turtle.build()
  63.     turtle.turnRight()
  64.     move()
  65. end
  66.  
  67.  
  68. function cobble()
  69.     for slot = buildSlot, buildSlot + 3, 1 do
  70.         if turtle.getSlotCount(slot) > 6 then
  71.             cobbleSlot = slot
  72.         else
  73.             print("Low on cobble")
  74.             cobbleSlot = buildSlot
  75.         end
  76.     end
  77. end
  78. --~Start of run
  79.  
  80. move()
  81. y = y + 1
  82. for y, length, 1 do
  83.     seal()
  84. end
  85.  
  86. for i = 0, 2, 1 do
  87.     height()
  88.     level = 0
  89. end
  90. turtle.turnRight()
  91. turtle.turnRight()
  92. move()
  93. y = y - 1
  94. for y, 0, -1 do
  95.     seal()
  96. end
  97. for i = 0, 2, 1 do
  98.     height()
  99.     level = 1
  100. end
  101. turtle.turnRight()
  102. turtle.turnRight()
  103. print("Finished")
Advertisement
Add Comment
Please, Sign In to add comment