danshat

OpenMine [OC Robot]

Apr 2nd, 2016
274
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. robot = require("robot")
  2. component = require("component")
  3. sides = require("sides")
  4. inv = component.inventory_controller
  5. geo = component.geolyzer
  6.  
  7. function mine()
  8. robot.swingDown()
  9. robot.forward()
  10. robot.swingDown()
  11. robot.forward()
  12. robot.swingDown()
  13. robot.turnLeft()
  14. robot.forward()
  15. robot.swingDown()
  16. robot.turnLeft()
  17. robot.forward()
  18. robot.swingDown()
  19. robot.forward()
  20. robot.swingDown()
  21. robot.turnRight()
  22. robot.forward()
  23. robot.swingDown()
  24. robot.turnRight()
  25. robot.forward()
  26. robot.swingDown()
  27. robot.forward()
  28. robot.swingDown()
  29. robot.turnRight()
  30. robot.forward()
  31. robot.forward()
  32. robot.turnRight()
  33. robot.forward()
  34. robot.forward()
  35. robot.down()
  36. robot.turnRight()
  37. robot.turnRight()
  38. end
  39.  
  40. while true do
  41. if robot.durability() == nil then
  42. print("Ошибка инструмента")
  43. os.exit()
  44. end
  45. slot = inv.getStackInInternalSlot(1)
  46. if slot == nil then
  47. print("Ошибка инструмента")
  48. os.exit()
  49. end
  50. if geo.analyze(0)["name"] == "minecraft:dirt" or geo.analyze(0)["name"] == "minecraft:grass" then
  51. slot = inv.getStackInInternalSlot(1)
  52. if slot["name"] == "minecraft:diamond_shovel" or slot["name"] == "minecraft:iron_shovel" or slot["name"] == "minecraft:stone_shovel" then
  53. inv.equip()
  54. end
  55. elseif geo.analyze(0)["name"] == "minecraft:bedrock" then
  56. print("Достигнут бедрок.")
  57. os.exit()
  58. else
  59. robot.select(1)
  60. slot = inv.getStackInInternalSlot(1)
  61. if slot["name"] == "minecraft:diamond_pickaxe" or slot["name"] == "minecraft:iron_pickaxe" or slot["name"] == "minecraft:stone_pickaxe" then
  62. inv.equip()
  63. end
  64. end
  65. mine()
  66. end
RAW Paste Data