Advertisement
Solomeister

lumberbot v0.2

Aug 7th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local robot = require("robot")
  2. local comp = require("computer")
  3. local component = require("component")
  4. local inv = component.inventory_controller
  5. local term = require("term")
  6. local sides = require("sides")
  7.  
  8.  
  9.  
  10. function leafBlower()
  11.   robot.select(4)
  12.   inv.equip()
  13.   while robot.detectUp() == false do
  14.     robot.up()
  15.   end
  16.  
  17.   while robot.detectUp() == true do
  18.     robot.swingUp()
  19.     robot.up()
  20.     robot.up()
  21.   end
  22.  
  23.   while robot.detectDown() == false do
  24.     robot.down()
  25.   end
  26.   os.sleep(1)
  27.   robot.up()
  28.   inv.equip()
  29.   robot.select(2)
  30. end
  31.      
  32. function routine()
  33.   _, det = robot.detect()
  34.   if det == 'solid' then
  35.     while robot.detect() == true do
  36.       robot.swing()
  37.     end
  38.     return  "chop"
  39.   elseif det == 'passable' then
  40.     robot.select(2)
  41.     inv.equip()
  42.     for i = 1, 10 do
  43.       robot.use()
  44.     end
  45.     robot.select(2)
  46.     inv.equip()
  47.     return "grow"
  48.   else
  49.     robot.select(1)
  50.     robot.place()
  51.     return "plant"  
  52.   end
  53. end
  54. function lumbMain()
  55.   b = 0
  56.     while robot.durability() ~= 0 do
  57.       if routine() == "chop" then
  58.         leafBlower()
  59.       end
  60.       robot.suckUp()
  61.       b = b + 1
  62.       if b == 100 then
  63.           for i = 5, 16 do
  64.             robot.select(i)
  65.             robot.dropDown()
  66.           end
  67.       b = 0
  68.       end
  69.       robot.select(2)
  70.     end
  71.   robot.select(2)
  72.   inv.equip()
  73.   robot.dropDown()
  74.   while robot.count(2) == 0 do
  75.     comp.beep()
  76.     os.sleep(1)
  77.   end
  78.   robot.select(1)
  79.   lumbMain()
  80. end
  81. lumbMain()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement