Minecoprocessors

Minecoprocessors

183k Downloads

Sugestion: A Way to Transfer Data

Jonnycake opened this issue ยท 3 comments

commented

Suggestion
So, first, I love the mod, but one thing that I think would make it better is a way to transfer data from one processor (or other redstone source) to another so that you can translate a single input different outputs. At the moment, the only way to do it is to have it be based on how long a pulse is, but that comes with the added issue of needing to synchronize the sender and receiver perfectly making it impossible to use a chest as input, for example.

Use Case
1 - Split a single input into multiple outputs - I have ToughAsNails installed and it comes with a season detector which gives off a redstone signal if it's set to the correct season. You could take that information into one processor, choose a specific output you want to be enabled downstream, and pass it over a single wire (for example - to go through a doorway) - maybe to enable climatisation.

2 - You can take input from a chest and based on it's fullness, light up a different light (or turn on/off a different part of a circuit).

I'm sure there's a ton more, but 1 is what originally inspired the idea and 2 is a more generic ability that it would enable.

Possible Implementation
The value could be based on the redstone strength of the input. That would be limited to 15, but that's large enough to use as a bitmask to determine which of the outputs need to be on (if splitting one input into 3 outputs).

Difficulty
Was going through the code, doesn't look like it would be too hard to implement as you're already getting the signal strength when you determine if it's on or off, you'd just have to set that value directly rather than casting it to a boolean (I think, not entirely sure if other issues would come from that though).

commented

Thanks for the suggestion!

I built the processor with one byte port registers instead of single bits with that type of functionality in mind. I had originally intended to make another mod that would add 8 bit bus blocks that could connect processors together and carry an entire byte, but I never got around to it. The bus block would have pins so that it could connect 8 redstone inputs (or outputs) to and send all that data as a one byte signal to a processor.

But that didn't happen, and it really looks like you are asking for an ADC. I could build in an auto ADC function that would update the top nibble with the redstone signal level of the port registers. A full signal would yield 0xF1 to the associated port register, and a signal strength of one would be 0x11. That would allow the register to mostly work as is, and provide a way to read the analog value (redstone level) of the input for more advanced use cases.

A DAC would be a little more involved since I would need to use a flag of some sort to switch a port to analog mode. I guess I could simply check the upper nibble for a non-zero value, and if one is set output an analog signal, so maybe not that difficult.

commented

Hah, yeah it did kind of look like there were a few features that just hadn't made it in yet, but yeah an ADC is exactly what I'm looking for :D

commented

I am currently working on another project, but I am hoping to get back working on this one after it. I have created a new issue to track this request: #8