Advertisement
Guest User

digger

a guest
Apr 7th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. function forward() turtle.forward() end
  2. function up() turtle.up() end
  3. function down() turtle.down() end
  4. function left() turtle.turnLeft() end
  5. function right() turtle.turnRight() end
  6.  
  7. function left2()
  8.  for
  9.   m = 1, 2, 1 do
  10.   left()
  11.  end
  12. end
  13.  
  14. function right2()
  15.  for
  16.   m = 1, 2, 1 do
  17.   right()
  18.  end
  19. end
  20.  
  21. function digDown()
  22.  while (true) do
  23.   if
  24.    turtle.detectDown() == true then
  25.    turtle.digDown(left)
  26.   else
  27.    break
  28.   end
  29.  end
  30. end
  31.  
  32. function dig()
  33.  while (true) do
  34.   if
  35.    turtle.detect() == true then
  36.    turtle.dig(left)
  37.   else
  38.    break
  39.   end
  40.  end
  41. end
  42.  
  43. function digUp()
  44.  while (true) do
  45.   if
  46.    turtle.detectUp() == true then
  47.    turtle.digUp(left)
  48.   else
  49.    break
  50.   end
  51.  end
  52. end
  53.  
  54. function detectDown()
  55.  if
  56.   turtle.detectDown() == false then
  57.   turtle.select(1)
  58.   turtle.placeDown()
  59.  end
  60. end
  61.  
  62. function detect()
  63.  if
  64.   turtle.detect() == false then
  65.   turtle.select(1)
  66.   turtle.place()
  67.  end
  68. end
  69.  
  70. function detectUp()
  71.  if
  72.   turtle.detectUp() == false then
  73.   turtle.select(1)
  74.   turtle.placeUp()
  75.  end
  76. end
  77.  
  78. -- left side of 3x3 tunnel
  79. dig()
  80.  forward()
  81.  left()
  82. detectDown()
  83. detect()
  84. digUp()
  85.  up()
  86. detect()
  87. digUp()
  88.  up()
  89. detect()
  90. detectUp()
  91. right2()
  92.  
  93. -- top side of 3x3 tunnel
  94. dig()
  95.  forward()
  96. detectUp()
  97. digDown()
  98. dig()
  99.  forward()
  100. detectUp()
  101. detect()
  102.  
  103. -- right side of 3x3 tunnel
  104. digDown()
  105.  down()
  106. detect()
  107. digDown()
  108.  down()
  109. detect()
  110. detectDown()
  111. left2()
  112.  
  113. -- bottom side of 3x3 tunnel
  114. dig()
  115.  forward()
  116. detectDown()
  117.  forward()
  118. right()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement