Advertisement
lpjakewolfskin

wooder

Feb 3rd, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. robot = require("robot")
  2.  
  3. function main()
  4.   while true do
  5.     local _, isWood = robot.detect()
  6.     if isWood == "solid" then
  7.       jack()
  8.       plant()
  9.     end
  10.     os.sleep(30)
  11.     suck()
  12.   end
  13. end
  14.  
  15. function jack()
  16.   while robot.detect() do
  17.     robot.swing()
  18.     robot.swingUp()
  19.     robot.up()
  20.   end
  21.   while not robot.detectDown() do
  22.     robot.down()
  23.   end
  24. end
  25.  
  26. function plant()
  27.   robot.place()
  28. end
  29.  
  30. function suck()
  31.   robot.turnRight()
  32.   for i = 0, 3 do
  33.     robot.forward()
  34.     robot.turnLeft()
  35.     robot.forward()
  36.     rotate()
  37.   end
  38.   robot.turnLeft()
  39. end
  40.  
  41. function rotate()
  42.   for i = 0, 3 do
  43.     robot.suck()
  44.     robot.turnRight()
  45.   end
  46. end
  47.  
  48. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement