View difference between Paste ID: 1u2ihYHK and EzT1pmEA
SHOW: | | - or go back to the newest paste.
1-
local robot = require("robot")
1+
local robot = require("robot")
2-
local comp = require("computer")
2+
local comp = require("computer")
3-
local component = require("component")
3+
local component = require("component")
4-
local inv = component.inventory_controller
4+
local inv = component.inventory_controller
5-
local term = require("term")
5+
local term = require("term")
6-
local sides = require("sides")
6+
local sides = require("sides")
7-
7+
8-
8+
9-
  
9+
  
10-
function leafBlower()
10+
function leafBlower()
11-
  robot.select(4)
11+
  robot.select(4)
12-
  inv.equip()
12+
  inv.equip()
13-
  while robot.detectUp() == false do
13+
  while robot.detectUp() == false do
14-
    robot.up()
14+
    robot.up()
15-
  end
15+
  end
16-
  
16+
  
17-
  while robot.detectUp() == true do
17+
  while robot.detectUp() == true do
18-
    robot.swingUp()
18+
    robot.swingUp()
19-
    robot.up()
19+
    robot.up()
20-
    robot.up()
20+
    robot.up()
21-
  end
21+
  end
22-
  
22+
  
23-
  while robot.detectDown() == false do
23+
  while robot.detectDown() == false do
24-
    robot.down()
24+
    robot.down()
25-
  end
25+
  end
26-
  os.sleep(1)
26+
  os.sleep(1)
27-
  robot.up()
27+
  robot.up()
28-
  inv.equip()
28+
  inv.equip()
29-
  robot.select(2)
29+
  robot.select(2)
30-
end
30+
end
31-
     
31+
     
32-
function routine() 
32+
function routine() 
33-
  _, det = robot.detect()
33+
  _, det = robot.detect()
34-
  if det == 'solid' then
34+
  if det == 'solid' then
35-
    while robot.detect() == true do
35+
    while robot.detect() == true do
36-
      robot.swing()
36+
      robot.swing()
37-
    end
37+
    end
38-
    return  "chop"
38+
    return  "chop"
39-
  elseif det == 'passable' then
39+
  elseif det == 'passable' then
40-
    robot.select(2)
40+
    robot.select(2)
41-
    inv.equip()
41+
    inv.equip()
42-
    for i = 1, 10 do
42+
    for i = 1, 10 do
43-
      robot.use()
43+
      robot.use()
44-
    end
44+
    end
45-
    robot.select(2)
45+
    robot.select(2)
46-
    inv.equip()
46+
    inv.equip()
47-
    return "grow"
47+
    return "grow"
48-
  else
48+
  else
49-
    robot.select(1)
49+
    robot.select(1)
50-
    robot.place()
50+
    robot.place()
51-
    return "plant"  
51+
    return "plant"  
52-
  end
52+
  end
53-
end
53+
end
54-
function lumbMain()
54+
function lumbMain()
55-
  b = 0 
55+
  b = 0 
56-
    while robot.durability() ~= 0 do
56+
    while robot.durability() ~= 0 do
57-
      if routine() == "chop" then
57+
      if routine() == "chop" then
58-
        leafBlower()
58+
        leafBlower()
59-
      end
59+
      end
60-
      robot.suckUp()
60+
      robot.suckUp()
61-
      b = b + 1
61+
      b = b + 1
62-
      if b == 100 then
62+
      if b == 100 then
63-
          for i = 5, 16 do
63+
          for i = 5, 16 do
64-
            robot.select(i)
64+
            robot.select(i)
65-
            robot.dropDown()
65+
            robot.dropDown()
66-
          end
66+
          end
67-
      b = 0
67+
      b = 0
68-
      end
68+
      end
69-
      robot.select(2)
69+
      robot.select(2)
70-
    end
70+
    end
71-
  robot.select(2)
71+
  robot.select(2)
72-
  inv.equip()
72+
  inv.equip()
73-
  robot.dropDown()
73+
  robot.dropDown()
74-
  while robot.count(2) == 0 do
74+
  while robot.count(2) == 0 do
75-
    comp.beep()
75+
    comp.beep()
76-
    os.sleep(1)
76+
    os.sleep(1)
77-
  end
77+
  end
78-
  robot.select(1)
78+
  robot.select(1)
79-
  lumbMain()
79+
  lumbMain()
80-
end
80+
end
81
lumbMain()