Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ AE2 Crystal Grower ]]--
- --[[ http://www.computercraft.info/forums2/index.php?/topic/20130-ae2-pure-certus-quartz-or-fluix-grower/ ]]--
- local iteration = 0
- rs.setOutput("back", false) -- turn off redstone
- turtle.suckDown() -- clear the pool
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(2, 2)
- local function checkForSource() -- If anything is in slot 13-16 we have crystals for comparison
- for i = 13, 16 do
- if turtle.getItemCount(i) > 0 then return true end
- end
- return false
- end
- local function checkForWork() -- If anything is in slot 1-12 we have work to do
- for i = 1, 12 do
- if turtle.getItemCount(i) > 0 then return true end
- end
- return false
- end
- local function checkWorkStatus() -- Check the status of the work in progress
- turtle.suckDown() -- Anything unfinished will be found by the
- for i = 1, 12 do -- next checkForWork cycle
- turtle.select(i)
- for j = 13, 16 do
- if turtle.compareTo(j) then turtle.dropUp() end
- end
- end
- end
- if not checkForSource() then
- term.write("No comparison crystals")
- term.setCursorPos(1, 4)
- return
- end
- term.write("Processing crystals...")
- term.setCursorPos(2, 4)
- term.write("Iteration")
- while true do -- Main loop
- iteration = iteration + 1
- term.setCursorPos(12, 4)
- if checkForWork() then -- Now we can turn on the accelerators
- rs.setOutput("back", true) -- and run a cycle
- for i = 1, 12 do
- turtle.select(i)
- turtle.dropDown() -- Since we have work, drop the items
- term.write(tostring(iteration) .. ": working")
- end
- os.sleep(60) -- now wait a bit for it to process
- checkWorkStatus()
- else
- rs.setOutput("back", false)
- term.write(tostring(iteration) .. ": idle ")
- os.sleep(6)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement