Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component=require("component")
- local robot=require("robot")
- local event=require("event")
- local modem=component.proxy(component.modem.address)
- local farmRunning=true
- local function modemListener(evt,_,_,_,_,msg)
- print("Message Rec")
- print(msg)
- farmRunning=false
- return false
- end
- local function harvest()
- for i=1,5 do
- robot.forward()
- robot.useDown()
- end
- end
- local function harvestHemp()
- for i=1,5 do
- robot.forward()
- robot.swingDown()
- robot.suckDown()
- end
- end
- local function positionHarvest()
- for i=1,2 do
- robot.forward()
- robot.turnRight()
- end
- end
- local function dropHarvest()
- for i=1,3 do
- robot.select(i)
- robot.dropDown()
- end
- robot.select(1)
- end
- local function repos()
- robot.turnRight()
- robot.forward()
- robot.turnRight()
- end
- modem.open(20202)
- event.listen("modem_message",modemListener)
- while farmRunning do
- harvest()
- positionHarvest()
- robot.up()
- harvestHemp()
- robot.forward()
- robot.down()
- dropHarvest()
- repos()
- os.sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement