Add conditional

This commit is contained in:
Salt 2023-12-01 12:14:25 -06:00
parent 8129f039cd
commit 946d96a6af

View File

@ -5,19 +5,25 @@ function placeBreeder()
breeder = peripheral.wrap('top')
-- First, we nab the new chicken in slot 1
turtle.select(1)
turtle.suckUp()
-- Then, we destroy the breeder
turtle.select(2)
turtle.digUp()
-- We are now in a position where we have:
-- 1: Good chicken
-- 2: Inferior chicken
-- 3: Seeds/second inferior chicken
-- 4: Breeder/seeds
-- 5: Null/breeder
-- In any case, discarding 1 item in slot 2 will eliminate poor genes
--turtle.select(2) -- Unnecessary due to previous instr
turtle.dropDown(1)
-- Check to see if this iteration obtained a new chicken
if turtle.suckUp() then
-- Then, we destroy the breeder
turtle.select(2)
turtle.digUp()
-- We are now in a position where we have:
-- 1: Good chicken
-- 2: Inferior chicken
-- 3: Seeds/second inferior chicken
-- 4: Breeder/seeds
-- 5: Null/breeder
-- In any case, discarding 1 item in slot 2 will eliminate poor genes
--turtle.select(2) -- Unnecessary due to previous instr
turtle.dropDown(1)
else
-- Just pop the breeder for consistency
turtle.select(2)
turtle.digUp()
end
-- Now we re set-up the breeder
selectItem('chickens:breeder')
turtle.placeUp()