Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local breederName = "chickens:breeder"
- local chickenChest = peripheral.wrap("front")
- local lightPos = "front"
- function cleanAllButNest()
- local nest = 1
- for i = 1, 16 do
- local d = turtle.getItemDetail(i)
- if d then
- if d.name ~= breederName then
- turtle.select(i)
- turtle.dropDown()
- else
- nest = i
- end
- end
- end
- turtle.select(nest)
- turtle.transferTo(1)
- turtle.select(1)
- end
- function flashLight(n)
- for i=1,n do
- rs.setOutput(lightPos, false)
- sleep(0.3)
- rs.setOutput(lightPos, true)
- sleep(0.3)
- end
- rs.setOutput(lightPos, false)
- end
- local slot = 15
- local generations = 0
- term.clear()
- term.setCursorPos(1,1)
- term.write("Generation: " .. generations)
- flashLight(5)
- while true do
- turtle.select(slot)
- if turtle.suckDown() then
- if slot == 16 then
- turtle.drop()
- turtle.select(15)
- turtle.drop()
- turtle.select(1)
- turtle.digDown()
- cleanAllButNest()
- sleep(2)
- turtle.placeDown()
- turtle.suckUp(2)
- turtle.dropDown(2)
- local chest = chickenChest.getItemDetail(1)
- if chest.count == 1 then
- chickenChest.pushItems("bottom", 1, 1, 1)
- chickenChest.pushItems("bottom", 2, 1, 2)
- else
- chickenChest.pushItems("bottom", 1, 1, 1)
- chickenChest.pushItems("bottom", 1, 1, 2)
- end
- slot = 15
- generations = generations + 1
- term.clear()
- term.setCursorPos(1,1)
- term.write("Generation: " .. generations)
- if generations >= 6 then
- flashLight(3)
- rs.setOutput(lightPos, true)
- else
- rs.setOutput(lightPos, false)
- end
- else
- slot = 16
- end
- sleep(45)
- else
- sleep(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement