Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pulse (side, colour)
- print("pulse ", side, ": ", colour)
- rs.setBundledOutput(side, colour)
- sleep(0.4)
- rs.setBundledOutput(side, 0)
- end
- function checkItemComparator()
- local level = rs.getAnalogInput("left")
- print("item comparator: ", level)
- return level
- end
- function preCrafting()
- -- pause to ensure all items get there
- sleep(2)
- -- a signal from below can be used to wait longer
- while rs.getInput("bottom") == true do
- print "locked: waiting 2 more seconds..."
- sleep(2)
- end
- end
- function pumpItems()
- local done = false
- -- loop till all items in the chest are ejected
- while done == false do
- compLevel = checkItemComparator()
- if compLevel > 0 then
- -- white = vanilla dropper (items)
- pulse("top", colors.white)
- else
- done = true
- end
- end
- end
- function watchCrafting()
- -- crafting has begun
- -- wait for strength 2 signal to finish
- -- runic altar's comparator outputs this
- local finished = 0
- for i = 0, 60 do
- local altar = rs.getAnalogInput("back")
- print("altar comparator: ", altar)
- if altar == 2 then
- pulse("top", colors.magenta)
- finished = 1
- break
- end
- sleep(1)
- end
- if finished == 0 then
- print("ERROR: crafting didn't finish after 60 seconds")
- end
- end
- print "Botania Rune Crafter active!"
- -- wait for a redstone signal from the input comparator
- while true do
- print("waiting on a redstone event...")
- os.pullEvent("redstone")
- if rs.getInput("left") == true then
- print("got redstone event from chest!")
- preCrafting()
- if checkItemComparator() > 0 then
- pumpItems()
- sleep(0.5)
- -- magenta = dispenser (wand of forest)
- pulse("top", colors.magenta)
- watchCrafting()
- end -- if checkItemComparator
- end -- if rs.getInput
- end -- while true
Advertisement
Add Comment
Please, Sign In to add comment