Advertisement
dlord

/miner/digDown

Dec 26th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. os.unloadAPI("/miner/movement")
  2. os.loadAPI("/miner/movement")
  3.  
  4. local depth
  5. local torchPlacementInterval=7
  6. local maxRetryCount=20
  7.  
  8. function returnAfterRetryFailed()
  9. movement.move(0, 0, 0)
  10. movement.face("NORTH")
  11.  
  12. write("\Move retry count reached!\n")
  13. print("Did you reach bedrock?")
  14. error()
  15. end
  16.  
  17. function mineBlockAndMoveDown()
  18. local retryCount=0
  19. while movement.down()==false do
  20. if retryCount>=maxRetryCount then
  21. returnAfterRetryFailed()
  22. end
  23.  
  24. if turtle.digDown()==false then
  25. turtle.attackDown()
  26. end
  27. sleep(0.500)
  28.  
  29. retryCount=retryCount+1
  30. end
  31. end
  32.  
  33. function digDown(depth)
  34. for i=1,depth do
  35. mineBlockAndMoveDown()
  36. end
  37. end
  38.  
  39. local args={...}
  40.  
  41. if #args >= 1 then
  42. depth=tonumber(args[1])
  43. digDown(depth)
  44. else
  45. print("digDown [depth]")
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement