PneumaticCraft: Repressurized

PneumaticCraft: Repressurized

43M Downloads

Passthrough Lowest

telemenar opened this issue ยท 3 comments

commented

I'd like an option on Redstone modules to passthrough least. Currently the passthrough option is always pass through greatest.

I'm currently trying to use this in an automation where if any of the signals is less than a threshold then I want to perform a task.

commented

I was curious so I went digging. I think all of the work is really in the configuration of it.

The logic would just be adding a conditional here:

if (mr.getRedstoneDirection() == EnumRedstoneDirection.INPUT && mr.getInputLevel() > levels[mr.getColorChannel()])

To use less than rather than greater than in this config mode.

commented

Yeah that's where the incoming signal level is calculated. I think this should be fairly straightforward. Not quite as clean as I'd like since most of the logic is handled within the Operation enum (by the SignalFunction), but this specific case will need a special-case if to get the incoming signal level. Bit of a code smell, but not sure there's a cleaner way...

commented

I mean an approach that would make it cleaner though risk performance problems on huge huge channels, would be to accumulate a list of channel signals there. Then let the Operation/SignalFunction do a max or min based on options from the list. Or potentially just accumulate a tuple of max/min that is always passed into the Operation/SignalFunction