Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local robot = require("robot")
- local geo = component.geolyzer
- local ic = component.inventory_controller
- local event = require "event"
- local checked = false
- local step = 0
- function placeCross()
- ic.equip()
- robot.useDown(0)
- os.sleep(0.1)
- robot.useDown(0)
- ic.equip()
- end
- while event.pull(1, "interrupted") == nil do
- meta = geo.analyze(0).metadata
- if meta == 7 then
- print("next")
- checked = false
- if step == 0 then
- step=1
- robot.turnLeft()
- robot.forward()
- robot.turnLeft()
- robot.forward()
- robot.swingDown()
- placeCross()
- else
- step=0
- robot.turnLeft()
- robot.forward()
- robot.swingDown()
- placeCross()
- end
- elseif not checked and meta > 0 then
- robot.useDown(0,false,0)
- if geo.analyze(0).metadata < meta then
- checked = true
- robot.useDown(0,false,0)
- print("Detected crop")
- else --weed
- print("Removing weeds")
- robot.select(2)
- ic.equip()
- robot.useDown(0,false,0)
- os.sleep(.4)
- robot.useDown(0,false,0)
- ic.equip()
- robot.select(1)
- ic.equip()
- robot.useDown(0,false,0)
- ic.equip()
- end
- else
- robot.up()
- os.sleep(5)
- robot.down()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement