Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component = require("component")
- sides = require("sides")
- robot = require("robot")
- inv = component.inventory_controller
- function harvest_turn(side)
- if side == sides.left then
- robot.turnLeft()
- elseif side == sides.right then
- robot.turnRight()
- elseif side == sides.back then
- robot.turnAround()
- elseif side == sides.front then
- return
- else print("Invalid side.")
- end
- end
- function harvest_peat()
- if not robot.compareDown() then
- robot.swingDown()
- robot.placeDown()
- end
- end
- function harvest_line(side, dist)
- harvest_turn(side)
- for i=1,dist do
- robot.forward()
- harvest_peat()
- end
- end
- function harvest_level() --could be generalized
- harvest_line(sides.front,5)
- harvest_line(sides.right,4)
- harvest_line(sides.right,4)
- harvest_line(sides.right,3)
- harvest_line(sides.right,3)
- harvest_line(sides.right,2)
- harvest_line(sides.right,2)
- harvest_line(sides.right,1)
- forward(2)
- robot.turnLeft()
- forward(2)
- robot.turnAround()
- end
- function forward(dist)
- for i=1,dist do
- robot.forward()
- end
- end
- function harvest_cube()
- harvest_level()
- robot.up()
- robot.up()
- harvest_level()
- robot.up()
- robot.up()
- robot.select(2)
- harvest_level()
- robot.up()
- robot.up()
- harvest_level()
- robot.down()
- robot.down()
- robot.down()
- robot.down()
- robot.down()
- robot.down()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement