Guest User

tunnel

a guest
Jun 21st, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. function getFuel()
  2. while turtle.getFuelLevel() < 70 do -- checks how many fuel and gets more only if needs to get more --
  3. while turtle.getItemCount(1) < 15 do
  4. turtle.select(3)
  5. turtle.placeUp()
  6. turtle.select(1)
  7. turtle.dropUp() --this "should" ensure that it doesn't pull 64 fuel out while you already have some and take up slot 3 with it by dropping existing coal in and getting more --
  8. turtle.suckUp()
  9. turtle.select(3)
  10. turtle.digUp()
  11. end
  12. turtle.select(1)
  13. turtle.refuel(10)
  14. end
  15. end
  16.  
  17. function enderChest() --Selects ender chest, goes through for loop to drop items off--
  18. turtle.select(2)
  19. turtle.placeUp()
  20. for i = 4 , 16 do
  21. turtle.select(i)
  22. turtle.dropUp()
  23. end
  24. turtle.select(2)
  25. turtle.digUp()
  26. end
  27.  
  28. function dig() -- spin and dig --
  29. turtle.turnLeft()
  30. turtle.dig()
  31. turtle.turnRight()
  32. turtle.turnRight()
  33. turtle.dig()
  34. turtle.turnLeft()
  35. end
  36.  
  37. function digMid() -- moves forward then digs out the middle layer--
  38. turtle.dig()
  39. turtle.forward()
  40. dig()
  41. end
  42.  
  43. function digTop() -- moves up and digs out the top layer and then goes back down to middle --
  44. turtle.digUp()
  45. turtle.up()
  46. dig()
  47. turtle.down()
  48. end
  49.  
  50. function digBot() -- moves down and digs out the bottom layer then back up to middle --
  51. turtle.digDown()
  52. turtle.down()
  53. dig()
  54. turtle.up()
  55. end
  56.  
  57. -- asks how far to dig, takes the value you give it and goes through a for loop to dig out your 3x3 tunnel --
  58. local far = 0
  59. term.write("How far should I dig: ")
  60. far = read()
  61. for i = 0, far do
  62. getFuel()
  63. digMid()
  64. digTop()
  65. digBot()
  66. enderChest()
  67. end
Advertisement
Add Comment
Please, Sign In to add comment