Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local detectSide = "back"
- local fireSide = "bottom"
- local activeSide = "left"
- local count = 8
- function detect(idx)
- local det = rs.getBundledInput(detectSide)
- return colors.test(det, bit.blshift(1, idx))
- end
- function current(idx)
- local fir = rs.getBundledOutput(fireSide)
- return colors.test(fir, bit.blshift(1, idx))
- end
- function set(idx, fire)
- local fir = rs.getBundledOutput(fireSide)
- local num = bit.blshift(1, idx)
- if fire then
- rs.setBundledOutput(fireSide, colors.combine(fir, num))
- else
- rs.setBundledOutput(fireSide, colors.subtract(fir, num))
- end
- end
- for i=0,(count-1) do
- set(i, false)
- end
- while true do
- if rs.getInput(activeSide) then
- for i=0,(count-1) do
- if detect(i) then
- if current(i) then
- set(i, false)
- sleep(0.4)
- end
- set(i, true)
- end
- end
- end
- os.pullEvent("redstone")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement