Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- --------
- -- colorful sheep farm
- -- --------
- local f = function() while not turtle.forward() do end end
- local b = function() while not turtle.back() do end end
- local l = turtle.turnLeft
- local r = turtle.turnRight
- local u = function() while not turtle.up() do end end
- local d = function() while not turtle.down() do end end
- local function exec(funcs)
- for i, f in ipairs(funcs) do
- f()
- end
- end
- local sel = turtle.select
- local cut = function() sel(1) turtle.place() end
- -- --------
- -- main
- -- --------
- while true do
- local shearsCnt = 12
- for h = 1, shearsCnt do
- print("fuel = " .. tostring(turtle.getFuelLevel()))
- exec({f,r,f,f,f,f,f,f,f,f,f,f,f,r,f,f,l,f})
- cut()
- for i = 1, 6 do
- exec({b,r,f,f,l,f})
- cut()
- end
- exec({b,l,f,l,f})
- cut()
- for i = 1, 5 do
- exec({b,r,f,f,l,f})
- cut()
- end
- exec({b,r,f,f,f,l})
- exec({f,f,f,f,f,f,f,f,f,f,f})
- exec({l,f,f})
- for i = 2, 16 do
- sel(i)
- turtle.dropDown()
- end
- exec({r,r,f,f,r,f,f,f,f,f,r,f,f,f,l,f})
- for i = 1, 5 do
- cut()
- exec({b,r,f,f,l,f})
- end
- cut()
- exec({l,l,f,f})
- for i = 1, 5 do
- cut()
- exec({b,r,f,f,l,f})
- end
- cut()
- exec({b,r,f,f,f,l,f,f,f,f,f,l,f,f})
- for i = 2, 16 do
- sel(i)
- if 0 < turtle.getItemCount(i) then
- local rslt = turtle.dropDown()
- if false == rslt then
- exec({l,l,f})
- error("wool chest is full!!")
- end
- end
- end
- if h == shearsCnt then
- sel(1)
- turtle.dropDown()
- exec({f,r})
- turtle.suck()
- if 0 == turtle.getItemCount() then
- exec({r,f,f})
- error("no shears!! please set shears at slot1.")
- end
- exec({r,f,l})
- else
- exec({r})
- end
- sel(16)
- if turtle.getFuelLevel() <= 20000 - 160 then
- turtle.suck(2)
- turtle.refuel()
- end
- sel(1)
- exec({r,f})
- term.write("sleep : ")
- for i = 12, 1, -1 do
- term.write(tostring(i).." ")
- os.sleep(6)
- end
- print("go!")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement