Advertisement
Guest User

tree

a guest
May 20th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local robot = require("robot")
  2. local comp = require("computer")
  3. local component = require("component")
  4. robot.select(1)
  5.  
  6. function chop()
  7.    robot.select(1)
  8.     if robot.compare() == true then do
  9.       robot.swing()
  10.       robot.select(2)
  11.       robot.place()
  12.       robot.select(1)
  13.       os.sleep(30)
  14.       end
  15.     else
  16.       do
  17.         robot.select(15)
  18.         component.inventory_controller.equip()
  19.         robot.use()
  20.         robot.use()
  21.         robot.use()
  22.         component.inventory_controller.equip()
  23.       end
  24. end
  25. end
  26. function unload()
  27.   robot.turnAround()
  28.   for c = 3, 14 do
  29.     robot.select(c)
  30.     if robot.count() > 0 then
  31.       robot.drop()
  32.     end
  33.   end
  34.   robot.select(1)
  35.   robot.turnAround()
  36. end
  37.  
  38. function charge()
  39.   robot.select(16)
  40.   component.inventory_controller.equip()
  41.   robot.dropDown()
  42.   os.sleep(25)
  43.   robot.suckDown()
  44.   component.inventory_controller.equip()
  45.   robot.select(1)
  46. end
  47.  
  48.  
  49. while true do
  50.   if robot.detect() == true then
  51.    chop()
  52.   end
  53.   if robot.count(3) == 64 then
  54.      unload()
  55.   end
  56.   if robot.count(2) < 2 then
  57.     robot.turnRight()
  58.     robot.suck()
  59.     robot.turnLeft()
  60.   end
  61.   if robot.durability() < 0.2 then do
  62.     break
  63.   end
  64. end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement