Advertisement
Liktorn

clearDebris

May 2nd, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. -- Program:
  2. --   clearDebris
  3. --   to be used on the miner created by DireWolf20 instead of using a force field
  4. -- Created by
  5. --   Liktorn
  6.  
  7. -- total length of the miner
  8. minerLength = 16
  9. -- position of the turtle (from the left)
  10. turtlePos = 3
  11. -- turtle distance from possible debris
  12. distDebris = 2
  13.  
  14.  
  15.  
  16.  
  17. -- moves the turtle i steps, destroying blocks on the way
  18. function moveDig(i)
  19.   while i > 0 do
  20.     turtle.dig()
  21.     turtle.forward()
  22.     i = i - 1
  23.   end
  24. end
  25.  
  26.  
  27. -- moves the turtle i steps
  28. function move(i)
  29.   while i > 0 do
  30.     turtle.forward()
  31.     i = i - 1
  32.   end
  33. end
  34.  
  35. -- turn the turtlr around
  36. function turnAround()
  37.   turtle.turnRight()
  38.   turtle.turnRight()
  39. end
  40.  
  41. -- move the turtle one block infront of miner and breaking the block in that space
  42. -- and dig and move down
  43. moveDig(distDebris)
  44. turtle.dig()
  45. turtle.forward()
  46. turtle.digDown()
  47. turtle.down()
  48.  
  49. -- dig all the way to the right
  50. turtle.turnRight()
  51. moveDig(minerLength - turtlePos)
  52.  
  53. -- dig, move down and turn
  54. turtle.digDown()
  55. turtle.down()
  56. turnAround()
  57.  
  58. -- dig all the way to the left
  59. moveDig(minerLength - 1)
  60.  
  61. -- dig, move up and turn
  62. turtle.digUp()
  63. turtle.up()
  64. turnAround()
  65.  
  66. -- dig and move to turtle to the chest
  67. moveDig(turtlePos - 1)
  68. turtle.up()
  69. turtle.turnRight()
  70. turtle.forward()
  71.  
  72. -- dump collected debris in chest below
  73. for i = 2, 16, 1 do
  74.   turtle.select(i)
  75.   turtle.dropDown()
  76. end
  77.  
  78. -- move turtle to it's designated place
  79. move(3)
  80. turnAround()
  81.  
  82. --place the chest in slot 1, then the platform is ready to be moved
  83. turtle.select(1)
  84. turtle.place()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement