--[[ AE2 Crystal Grower LiLRichy Edit - 04/22/2023 ]]-- --[[ Change Log: Version 1.0.1 - Changed to use only the last inventory slot as the compare slot - Increased inventory to all but the last slot - Decreased the idle time a bit - Added variable for the side to emit Redstone - Fix items being left after one stack is picked up - Fix "working" spam in terminal - Code cleanup Version 1.0.0 - Initial Edit ]]-- local side = "back" -- The side to emit the redstone signal when work is being done local iteration = 0 rs.setOutput(side, 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 16 we have a crystal for comparison if turtle.getItemCount(16) > 0 then return true end return false end local function checkForWork() -- If anything is in slots 1-15 we have work to do for i = 1, 15 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 for i = 1, 15 do turtle.select(i) turtle.suckDown() if turtle.compareTo(16) then turtle.dropUp() -- Puts finished items in inventory "UP" 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(side, true) term.write(tostring(iteration) .. ": working") for i = 1, 15 do -- and run a cycle turtle.select(i) turtle.dropDown() -- Since we have work, drop the items end os.sleep(10) -- now wait for it to process checkWorkStatus() else -- no more work to do rs.setOutput(side, false) term.write(tostring(iteration) .. ": idle ") os.sleep(3) -- wait to check again end end