note - i think this has a bunch of bugs and at the moment I don't have time to fix them. marking as deprecated.
Selector Combinator
Friday Facts #384 debuted a new combinator, the Selector combinator.
This mod implements that combinator, minus the rocket and quality parts.
Features
-
Select Input: Take the input signals, sort them by value descending or ascending, then output the signal at the specified index. You can use a red wire to control which input should be taken from the green wire.
-
Count Inputs: Take the count of input signals and output it.
-
Random Input: At a specified interval of seconds or ticks, a random signal from the input will be chosen and outputted.
-
Stack Size: For each input signal, output the stack size.
Example usages
- Count Input/Select Input: Cycle through inputs every second
Wire up a box to a combinator in Count Input mode, output count to a combinator multiplying it by 60, output that to a clock which resets on that count, then divide the clock by 60 and wire that to a Select Input combinator. Finally, wire its output to a filter inserter set to filter on the input. It'll pick out items from the box, cycling through each input one a second.
Another way of doing this is with the random mode:
- Random Input
Limitations
Hovering over the combinator will only show the input signals, not the outputs. You'll have to connect it to a power pole to see the outputs.
The combinator runs code on every tick. Will this blow up your UPS? Probably!
Credits
Some code modified from Cybersyn and Editor Extensions, both of which are licensed under MIT.