Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local com = require("component")
- local e = require("event")
- local co = require("computer")
- local inv = com.inventory_controller
- local inv_size = robot.inventorySize()
- local geo = com.geolyzer
- local sob = com.tractor_beam.suck
- local trse,da = true,true
- local function spusk()
- da=false
- local tek=robot.select()
- for i=7, inv_size do
- local s = inv.getStackInInternalSlot(i)
- if s ~= nil then
- if s.name == "minecraft:log" or s.name == "minecraft:coal" or s.name == "minecraft:sapling" or s.name == "minecraft:apple" then
- robot.select(i)
- robot.dropDown()
- --elseif s.name == "Forestry:sapling" then
- -- robot.select(i)
- -- robot.dropUp()
- end
- end
- end
- robot.select(tek)
- da=true
- end
- local tim = e.timer(60*4,spusk,math.huge)
- local function inv_scaner(filter)
- for i=1, inv_size do
- if inv.getStackInInternalSlot(i) ~= nil then
- if inv.getStackInInternalSlot(i).name == filter then
- return i
- end
- end
- end
- return 0
- end
- local function pitanie()
- da=false
- local tek=robot.select()
- if co.energy() <= 10000 then
- local pe=inv_scaner("minecraft:coal")
- if pe ~= 0 then
- local size = inv.getStackInInternalSlot(pe).size
- robot.select(pe)
- com.generator.insert(size-1)
- end
- end
- robot.select(tek)
- da=true
- end
- local pit=e.timer(60*2,pitanie,math.huge)
- local function inv_scaner2()
- robot.turnAround()
- for i=1, inv_size do
- if inv.getStackInSlot(3,i) ~= nil then
- if inv.getStackInSlot(3,i).name == "Forestry:fertilizerCompound" then
- return i
- end
- end
- end
- return 0
- end
- while true do
- if da then
- local udo = inv_scaner("Forestry:fertilizerCompound")
- if geo.analyze(3).name=="minecraft:air" then
- local sl = inv_scaner("Forestry:sapling")
- if sl ~= 0 then
- robot.select(sl)
- robot.place()
- else
- print("Где саплинги??? у тебя есть 3 секунды, а то я...")
- os.sleep(3)
- end
- else
- if udo ~= 0 then
- robot.select(udo)
- repeat
- trse=robot.place()
- os.sleep(0.1)
- until trse == false or trse == nil
- else
- local udob = inv_scaner2()
- if udob ~= 0 then
- inv.suckFromSlot(3,udob)
- robot.turnAround()
- else
- print("Где удобрение??? у тебя есть 3 секунды, а то я...")
- end
- os.sleep(3)
- end
- if not trse then
- robot.swing()
- os.sleep(2)
- repeat
- trse=sob()
- until trse==false
- end
- end
- end
- os.sleep()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement