Advertisement
Ganeesya

ddig

Mar 22nd, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. function checking(list,func)
  2. if type(func) ~= "function" then
  3. write("need select function")
  4. shell.exit()
  5. end
  6. local suc,ans = func()
  7. if suc == false then return false end
  8. for i, v in ipairs(list) do
  9. if v.name == ans.name then
  10. if v.metadata == nil then
  11. return true
  12. else
  13. if v.metadata == ans.metadata then
  14. return true
  15. end
  16. end
  17. end
  18. end
  19. end
  20.  
  21. function selectFromID(idname)
  22. for i = 1, 16 do
  23. if turtle.getItemCount(i) > 0 then
  24. if turtle.getItemDetail(i)["name"] == idname then
  25. turtle.select(i)
  26. return true
  27. end
  28. end
  29. end
  30. return false
  31. end
  32.  
  33. function isEmpty()
  34. for i = 1, 16 do
  35. if turtle.getItemCount(i) > 0 then
  36. return false
  37. end
  38. end
  39. return true
  40. end
  41.  
  42. local NGS = { {name = "minecraft:bedrock"}
  43. , {name = "minecraft:flowing_lava",metadata = 0}
  44. , {name = "factorization:BlastedBedrock"}}
  45. while true do
  46. local dlong = 0
  47. while true do
  48. turtle.select(1)
  49. if checking(NGS,turtle.inspectDown) then
  50. break
  51. end
  52. turtle.digDown()
  53. turtle.down()
  54. dlong = dlong + 1
  55. if checking(NGS,turtle.inspect) then
  56. break
  57. end
  58. turtle.dig()
  59. end
  60. turtle.turnLeft()
  61. turtle.turnLeft()
  62. for i = 1, dlong do
  63. turtle.dig()
  64. turtle.up()
  65. end
  66. if selectFromID("minecraft:cobblestone") then
  67. turtle.down()
  68. turtle.place()
  69. turtle.turnLeft()
  70. turtle.turnLeft()
  71. turtle.place()
  72. turtle.up()
  73. turtle.placeDown()
  74. turtle.turnLeft()
  75. turtle.turnLeft()
  76. end
  77.  
  78. turtle.turnLeft()
  79. turtle.turnLeft()
  80. turtle.dig()
  81. turtle.forward()
  82. turtle.dig()
  83. turtle.forward()
  84. turtle.dig()
  85. turtle.forward()
  86.  
  87. write("\nnow fuel is "..turtle.getFuelLevel()..".\nplz take all items.")
  88. while not isEmpty() do
  89. os.pullEvent("turtle_inventory")
  90. end
  91. write("\ncheck it.")
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement