Advertisement
Guest User

WIP Mining Turtle

a guest
Jul 24th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. function mine(pos)
  2. if turtle.getItemCount(16) then
  3. for a = 0, 15 do
  4. turtle.select(16 - a)
  5. if turtle.compare() and turtle.getItemCount(16 - a) 64 then
  6. empty()
  7. end
  8. end
  9. end
  10. repeat
  11. turtle.dig()
  12. turtle.attack()
  13. until turtle.forward()
  14. gps()
  15. end
  16.  
  17. function up(pos)
  18. if turtle.getItemCount(16) then
  19. for a = 0, 15 do
  20. turtle.select(16 - a)
  21. if turtle.compareUp() and turtle.getItemCount(16 - a) 64 then
  22. empty()
  23. end
  24. end
  25. end
  26. repeat
  27. turtle.digUp()
  28. turtle.attackUp()
  29. until turtle.up()
  30. gps()
  31. end
  32.  
  33. function down(pos)
  34. if turtle.getItemCount(16) then
  35. for a = 0, 15 do
  36. turtle.select(16 - a)
  37. if turtle.compareDown() and turtle.getItemCount(16 - a) 64 then
  38. empty()
  39. end
  40. end
  41. end
  42. repeat
  43. turtle.digDown()
  44. turtle.attackDown()
  45. until turtle.up()
  46. gps()
  47. end
  48.  
  49. function gps()
  50. if pos == "x+" then
  51. x = x + 1
  52. elseif pos == "x-" then
  53. x = x - 1
  54. elseif pos == "y+" then
  55. y = y + 1
  56. elseif pos == "y-" then
  57. y = y - 1
  58. elseif pos == "z+" then
  59. z = z + 1
  60. elseif pos == "z-" then
  61. z = z - 1
  62. end
  63. end
  64.  
  65. local x = 0
  66. local y = 0
  67. local z = 0
  68.  
  69. while true do
  70. while turtle.getFuelLevel() > 1 do
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement