Advertisement
ThaWade

ComputerCraft Program: buildTunnel

Dec 29th, 2015
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  1. --pastebin get H6kpjMY6
  2.  
  3. function isCobbleFront()
  4.     if turtle.inspect() ~= "minecraft:cobblestone" then
  5.         turtle.dig()
  6.     end
  7. end
  8.  
  9. function isCobbleUp()
  10.     if turtle.inspectUp() ~= "minecraft:cobblestone" then
  11.     turtle.digUp()
  12.     end
  13. end
  14.  
  15. function isCobbleDown()
  16.     if turtle.inspectDown() ~= "minecraft:cobblestone" then
  17.         turtle.digDown()
  18.     end
  19. end
  20.  
  21. function moveForward()
  22.   if not turtle.detect() then
  23.     turtle.forward()
  24.     else turtle.dig()
  25.   end
  26. end
  27.  
  28. function checkUp()
  29.   if not turtle.detectUp() then
  30.     turtle.select(1)
  31.     turtle.placeUp()
  32.   end
  33. end
  34.  
  35. function bottomSpot()
  36.     isCobbleDown()
  37.         if not turtle.detectDown() then
  38.             turtle.select(1)
  39.             turtle.placeDown()
  40.         end
  41. end
  42.  
  43. function firstLeftWall()
  44.     turtle.turnLeft()
  45.     --isCobbleFront()
  46.     if not turtle.detect() then
  47.         turtle.select(1)
  48.         turtle.place()
  49.     end
  50. end
  51.  
  52. function secondLeftWall()
  53.     turtle.up()
  54.     --isCobbleUp()
  55.     if not turtle.detect() then
  56.         turtle.select(1)
  57.         turtle.place()
  58.     end
  59. end
  60.  
  61. function aboutFace()
  62.     for i = 1, 2 do
  63.         turtle.turnLeft()
  64.     end
  65. end
  66.  
  67. function secondRightWall()
  68.     --isCobbleFront()
  69.     if not turtle.detect() then
  70.         turtle.select(1)
  71.         turtle.place()
  72.     end
  73. end
  74.  
  75. function roof()
  76.     --isCobbleUp()
  77.     if not turtle.detectUp() then
  78.         turtle.select(1)
  79.         turtle.placeUp()
  80.     end
  81. end
  82.  
  83. function firstRightWall()
  84.     turtle.down()
  85.     --isCobbleFront()
  86.     if not turtle.detect() then
  87.         turtle.select(1)
  88.         turtle.place()
  89.     end
  90. end
  91.  
  92. print("How far would you like to go?")
  93. distance = io.read()
  94.  
  95. for i = 1, distance do
  96.         bottomSpot()
  97.         firstLeftWall()
  98.         secondLeftWall()
  99.         aboutFace()
  100.         secondRightWall()
  101.         roof()
  102.         firstRightWall()
  103.         secondRightWall()
  104.         turtle.turnLeft()
  105.         moveForward()
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement