Advertisement
Captain_Admiral

MiningTurtle2

Apr 9th, 2013
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. local start = true
  2. local counter = 0
  3.  
  4. --Inventory:
  5. --Fuel,#,#,#
  6. --#,#,#,#
  7. --#,#,#,#
  8. --#,#,#,Ender Chest
  9.  
  10. --[[
  11. Type:
  12. PeripheralLeft - PickAxe
  13. PeripheralRight - Compass
  14. --]]
  15.  
  16.  
  17. while true do
  18.  
  19. function refuelSelf()
  20. if turtle.getFuelLevel()<500 then
  21. while turtle.getFuelLevel()<500 do
  22. for i=1,15,1 do
  23. turtle.select(i)
  24. turtle.refuel(1)
  25. turtle.select(1)
  26. end
  27. end
  28. end
  29. end
  30.  
  31. function fillChest()
  32. turtle.select(16)
  33. while not turtle.placeDown() do
  34. turtle.digDown()
  35. end
  36. for i=2,15,1 do
  37. turtle.select(i)
  38. turtle.dropDown()
  39. end
  40. if turtle.getItemCount(16) > 0 then
  41. for i = 2, 15, 1 do
  42. if turtle.transferTo(i) then
  43. break
  44. end
  45. if i == 15 then
  46. os.terminate()
  47. end
  48. end
  49. end
  50. turtle.select(16)
  51. turtle.digDown()
  52. turtle.select(1)
  53. end
  54.  
  55. --Startup
  56. if start == true then
  57. print("Hi! My name is Liam!")
  58. print("Job: Mining")
  59. print("")
  60. print("Inventory:")
  61. print("Fuel,#,#,#")
  62. print("#,#,#,#")
  63. print("#,#,#,#")
  64. print("#,# #,Ender Chest")
  65. print("")
  66. turtle.select(16)
  67. if turtle.getItemCount(16) ~= 1 then
  68. if turtle.getItemCount(16) ~= 0 then
  69. os.terminate()
  70. else
  71. turtle.fillChest()
  72. end
  73. end
  74. turtle.select(1)
  75. end
  76.  
  77.  
  78. --Main
  79.  
  80. counter = counter + 1
  81.  
  82. turtle.dig()
  83. turtle.digUp()
  84. turtle.digDown()
  85. while not turtle.forward() do
  86. turtle.dig()
  87. end
  88. refuelSelf()
  89. if counter >= 15 then
  90. turtle.select(16)
  91. if turtle.getItemCount(16) > 1 then
  92. os.terminate()
  93. end
  94. fillChest()
  95. counter = 0
  96. end
  97.  
  98.  
  99.  
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement