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.95 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.  if
  23.   turtle.detectDown() == true then
  24.   turtle.select(2)
  25.   if
  26.    turtle.compare() == true then
  27.    turtle.digDown(right)
  28.   elseif
  29.    turtle.select(3)
  30.    turtle.compareDown() == true then
  31.    turtle.digDown(right)
  32.   else
  33.    turtle.digDown(left)
  34.   end
  35.  end
  36. end
  37.  
  38. function dig()
  39.  if
  40.   turtle.detect() == true then
  41.   turtle.select(2)
  42.   if
  43.    turtle.compare() == true then
  44.    turtle.dig(right)
  45.   elseif
  46.    turtle.select(3)
  47.    turtle.compare() == true then
  48.    turtle.dig(right)
  49.   else
  50.    turtle.dig(left)
  51.   end
  52.  end
  53. end
  54.  
  55. function digUp()
  56.  if
  57.   turtle.detectUp() == true then
  58.   turtle.select(2)
  59.   if
  60.    turtle.compareUp() == true then
  61.    turtle.digUp(right)
  62.   elseif
  63.    turtle.select(3)
  64.    turtle.compare() == true then
  65.    turtle.digUp(right)
  66.   else
  67.    turtle.digUp(left)
  68.   end
  69.  end
  70. end
  71.  
  72. function detectDown()
  73.  if
  74.   turtle.detectDown() == false then
  75.   turtle.select(1)
  76.   turtle.placeDown()
  77.  end
  78. end
  79.  
  80. function detect()
  81.  if
  82.   turtle.detect() == false then
  83.   turtle.select(1)
  84.   turtle.place()
  85.  end
  86. end
  87.  
  88. function detectUp()
  89.  if
  90.   turtle.detectUp() == false then
  91.   turtle.select(1)
  92.   turtle.placeUp()
  93.  end
  94. end
  95.  
  96. dig()
  97. --[[
  98. -- left side of 3x3 tunnel
  99. dig()
  100.  forward()
  101.  left()
  102. detectDown()
  103. detect()
  104. digUp()
  105.  up()
  106. detect()
  107. digUp()
  108.  up()
  109. detect()
  110. detectUp()
  111. right2()
  112.  
  113. -- top side of 3x3 tunnel
  114. dig()
  115.  forward()
  116. detectUp()
  117. digDown()
  118. dig()
  119.  forward()
  120. detectUp()
  121. detect()
  122.  
  123. -- right side of 3x3 tunnel
  124. digDown()
  125.  down()
  126. detect()
  127. digDown()
  128.  down()
  129. detect()
  130. detectDown()
  131. left2()
  132.  
  133. -- bottom side of 3x3 tunnel
  134. dig()
  135.  forward()
  136. detectDown()
  137.  forward()
  138. right()
  139. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement