Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require('component')
- local inventory_controller = com.inventory_controller
- local rob = require('robot')
- local term = require('term')
- local slot = 1
- local m = 0 --минуты
- local sec = 0
- local tree2Num = 0
- local tree1 = 0
- local tree2 = 0
- local time = -9984
- local B = 1
- local S = 0
- local block = 0
- local otvet = 0
- term.clear()
- print('======================Planter=====================') --50
- print('Сколько деревьев высадить? (в одном ряду)')
- tree1 = io.read()
- print('Количество рядов: ')
- tree2 = io.read()
- print('Растояние между деревьев')
- S = io.read()
- print('Выберите режим')
- print('1) Единичная высадка')
- print('2) Повторение высадки, через промежуток времени')
- otvet = io.read()
- if otvet == '2' then
- print('Время между высаживаниями (в минутах)')
- time = io.read()
- time = time*60
- end
- print('Мне надо '..(tree2*tree1)..' саженца(ов).')
- print('Нажмите любую клавишу, что бы начать.')
- otvet = io.read()
- term.clear()
- print('======================Planter=====================')
- print('Я работаю')
- S = S+1
- tree1 = tree1-1
- rob.select(1)
- while true do
- for i10 = 1,(((tree1+1)*tree2)/64)-((((tree1+1)*tree2)%64)/64) do
- rob.suckDown()
- rob.select(slot+1)
- end
- rob.suckDown(((tree1+1)*tree2)%64)
- slot = 1
- rob.select(1)
- block = 0
- rob.swingUp()
- rob.up()
- rob.swing()
- rob.forward()
- term.clear()
- print('======================Planter=====================')
- print('Я работаю')
- sec = time-1
- for i5 = 1,tree2 do
- tree2Num = tree2Num+1
- for i2 = 1,tree1 do
- rob.swingDown()
- rob.select((block/64)-((block%64)/64)+1)
- if block/64 == (block/64)-((block%64)/64) then
- com.inventory_controller.equip()
- end
- block = block+1
- rob.useDown()
- for i1 = 1,S do
- rob.swing()
- rob.forward()
- end
- end
- rob.swingDown()
- rob.select((block/64)-((block%64)/64)+1)
- if block/64 == (block/64)-((block%64)/64) then
- com.inventory_controller.equip()
- end
- block = block+1
- rob.useDown()
- if tree2-tree2Num == 0 then
- if B == 1 then
- rob.turnRight()
- rob.swing()
- rob.forward()
- rob.turnRight()
- for i6 = 1,S*(tree1)+1 do
- rob.swing()
- rob.forward()
- end
- rob.turnRight()
- rob.swing()
- rob.forward()
- else
- rob.swing()
- rob.forward()
- rob.turnRight()
- end
- for i8 = 1,S*(tree2-1) do
- rob.swing()
- rob.forward()
- end
- rob.turnRight()
- rob.swingDown()
- rob.down()
- elseif B == 1 then
- rob.turnRight()
- for i3 = 1,S do
- rob.swing()
- rob.forward()
- end
- rob.turnRight()
- B = 2
- else
- B = 1
- rob.turnLeft()
- for i4 = 1,S do
- rob.swing()
- rob.forward()
- end
- rob.turnLeft()
- end
- end
- tree2Num = 0
- B = 1
- term.clear()
- slot = 1
- rob.turnLeft()
- for i11 = 1,16 do
- rob.select(slot)
- rob.drop()
- slot = slot+1
- end
- com.inventory_controller.equip()
- rob.drop()
- rob.turnRight()
- slot = 1
- rob.select(1)
- if time == -9984 then
- break
- else
- for i9 = 1,time do
- term.clear()
- print('======================Planter=====================')
- print('Я пойду работать через: '..(sec/60)-((sec%60)/60)..'мин. '..(sec%60)..'сек.')
- os.sleep(1)
- sec = sec-1
- end
- rob.select(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement