pirga

ферма сушек 2 раб

Aug 13th, 2019 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. local robot = require("robot")
  2. local inv = require("component").inventory_controller
  3.  
  4. function right()
  5. robot.turnRight()
  6. go()
  7. robot.turnLeft()
  8. end
  9.  
  10. function left()
  11. robot.turnLeft()
  12. go()
  13. robot.turnRight()
  14. end
  15.  
  16. function up()
  17. while not robot.up() do
  18. os.sleep(.1)
  19. end
  20. end
  21.  
  22. function down()
  23. while not robot.down() do
  24. os.sleep(.1)
  25. end
  26. end
  27.  
  28. function go()
  29. while not robot.forward() do
  30. os.sleep(.1)
  31. end
  32. end
  33.  
  34. function changeTool(i)
  35. robot.select(i)
  36. inv.equip()
  37. end
  38.  
  39. function goToStart()
  40. right()
  41. down()
  42. down()
  43. end
  44.  
  45. function place()
  46. while not robot.use() do
  47. os.sleep(.1)
  48. end
  49. end
  50.  
  51. function createIs()
  52. place()
  53. up()
  54. left()
  55. place()
  56. right()
  57. place()
  58. right()
  59. place()
  60. up()
  61. changeTool(2)
  62. place()
  63. left()
  64. place()
  65. left()
  66. place()
  67. changeTool(2)
  68. end
  69.  
  70. function killIs()
  71. changeTool(1)
  72. while robot.swing() do
  73. robot.swing()
  74. end
  75. changeTool(1)
  76. end
  77.  
  78. function dropInv()
  79. --robot.suckUp()
  80. up()
  81. left()
  82. for i = 3, 16 do
  83. robot.select(i)
  84. robot.dropDown()
  85. end
  86. right()
  87. down()
  88. end
  89.  
  90. while true do
  91. while robot.count(2) > 2 do
  92. print("начало")
  93. createIs()
  94. goToStart()
  95. os.sleep(5)
  96. killIs()
  97. os.sleep(1)
  98. if robot.count(3) > 0 then
  99. dropInv()
  100. end
  101. print("конец")
  102. end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment