Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local r = require("robot")
- local component = require("component")
- local g = component.geolyzer
- local slots = r.inventorySize()
- local computer = require("computer")
- local tty = require("tty")
- local function harvest()
- r.forward()
- if g.analyze(0).growth == 1 then
- r.swingDown()
- end
- end
- local function harvestLine()
- for i = 1, 36, 1 do
- harvest()
- end
- end
- local function turnAroundLeft()
- r.forward()
- r.turnLeft()
- r.forward()
- r.turnLeft()
- end
- local function turnAroundRight()
- r.forward()
- r.turnRight()
- r.forward()
- r.turnRight()
- end
- local function dropAll()
- for i = 1, slots, 1 do
- r.select(i)
- if r.count == 0 then
- break
- end
- r.dropDown()
- end
- end
- local function harvestPatch()
- harvestLine()
- turnAroundLeft()
- harvestLine()
- turnAroundRight()
- harvestLine()
- turnAroundLeft()
- harvestLine()
- r.forward()
- dropAll()
- end
- local function moveToNextPatch()
- r.turnRight()
- r.forward()
- r.forward()
- r.turnRight()
- end
- harvestPatch()
- for i = 1, 5, 1 do
- moveToNextPatch()
- harvestPatch()
- end
- r.turnLeft()
- for i = 1, 28, 1 do
- r.forward()
- end
- r.turnLeft()
- tty.clear()
- computer.shutdown()
Add Comment
Please, Sign In to add comment