thetechboy

ventshaft

Aug 12th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. glow = 0
  2. function moveForward()
  3. repeat
  4. turtle.dig()
  5. until turtle.forward()
  6. end
  7.  
  8. function mineUp()
  9. repeat
  10. turtle.digUp()
  11. until turtle.up()
  12. end
  13.  
  14. function refuel()
  15. if turtle.getFuelLevel() <= 5 then
  16. turtle.select(16)
  17. turtle.refuel(1)
  18. end
  19. end
  20.  
  21. function selectLadder()
  22. turtle.select(15)
  23. if turtle.getItemCount(15) == 1 then
  24. turtle.select(1)
  25. while not turtle.compareTo(15) do
  26. for i = 1,12 do
  27. turtle.select(i)
  28. end
  29. end
  30. end
  31. end
  32.  
  33. function selectDirt()
  34. turtle.select(14)
  35. if turtle.getItemCount(14) == 1 then
  36. turtle.select(1)
  37. while not turtle.compareTo(14) do
  38. for i = 1,12 do
  39. turtle.select(i)
  40. end
  41. end
  42. end
  43. end
  44.  
  45. function placeLadder()
  46. selectLadder()
  47. if not turtle.place() then
  48. selectDirt()
  49. moveForward()
  50. turtle.place()
  51. turtle.back()
  52. selectLadder()
  53. if not turtle.place() then
  54. return false
  55. end
  56. end
  57. end
  58.  
  59. function torch()
  60. if glow == 6 then
  61. turtle.digDown()
  62. turtle.select(13)
  63. turtle.placeDown()
  64. glow = glow-glow
  65. end
  66. end
  67. print "Place ladder instance in slot 15, Fuel in 16, and dirt/stone in 14. Torches go in 13."
  68. print "When only one ladder or filler is in their slots, program will look elsewhere."
  69. print "How deep do you want to mine? (z)"
  70. z = io.read()
  71. z = tonumber(z)
  72. print "Press any key to run."
  73. os.pullEvent("char")
  74.  
  75. for i = 1,z do
  76. turtle.digDown()
  77. turtle.down()
  78. refuel()
  79. end
  80. moveForward()
  81. refuel()
  82. turtle.turnLeft()
  83. turtle.turnLeft()
  84. for i = 1,z do
  85. if not placeLadder() then
  86. --break
  87. end
  88. torch()
  89. selectDirt()
  90. turtle.placeDown()
  91. mineUp()
  92. refuel()
  93. glow = glow+1
  94. end
Add Comment
Please, Sign In to add comment