Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local comp = require("computer")
- io.write("Длина:")
- local a = io.read()
- io.write("Ширина:")
- local b = io.read()
- io.write("Слоты:")
- local d = io.read()
- io.write("Промежутки между сбором:")
- local n = io.read()
- n = tonumber(n)
- function harvest()
- for y=1, (b-1) do
- robot.useDown()
- for x=1, (a-1) do
- robot.forward()
- robot.useDown()
- end
- -- разворот-------------------
- if y%2 == 1 then
- robot.turnLeft()
- robot.forward()
- robot.turnLeft()
- else
- robot.turnRight()
- robot.forward()
- robot.turnRight()
- end
- end
- -- возврат-----------------------
- if b%2 == 0 then
- for y=1, (a-1) do
- robot.useDown()
- robot.forward()
- robot.useDown()
- end
- robot.turnLeft()
- for x=1, (b-1) do
- robot.forward()
- end
- else
- for y=1, (a-1) do
- robot.useDown()
- robot.forward()
- robot.useDown()
- end
- robot.turnRight()
- for y=1, (b-1) do
- robot.forward()
- end
- robot.turnRight()
- for y=1, (a-1) do
- robot.forward()
- end
- robot.turnLeft()
- end
- end
- ----функция разгрузки в сундук--
- function unload()
- robot.turnRight()
- robot.select(chest)
- for z=1, d do
- robot.select(z)
- robot.drop(64)
- end
- robot.turnAround()
- end
- ----функция сна после завершения цикла--
- while true do
- -- one hour sleeping
- for i=1, 1 do
- os.sleep(n)
- print("Готовность:")
- print((10*i)..'%')
- end
- ----выполнение-------------------
- harvest()
- unload()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement