justarandomgeek / nixie-tubes

mod for Factorio adding nixie tubes
MIT License
13 stars 9 forks source link

Request: support for signal strings #37

Open sparr opened 2 years ago

sparr commented 2 years ago

It would be nice if the alpha nixie tubes could take in a signal string at the rightmost nixie and display the whole string. I'd be up for coding this if the feature is welcome.

Lukesleftleg commented 2 years ago

This would be a great feature. I was thinking about having a go myself actually, but I don't have a lot of LUA or Factorio modding experience, At the moment, you can send a single letter or symbol with a Constant Comparator, but I was thinking, say, if you gave the first letter a value of one, the second a value of two, and so on. For example, for "hello", have the comparator send "H" with value one, "E" with value two, two "L"s with value three and four, and I'm sure you can work out the value of "O". That was just one idea though, but it would be very nice to not have to have one comparator for each nixie when you want a whole word. You could probably even set up a circuit that could cycle between words or something.

sparr commented 2 years ago

@Lukesleftleg if you do want to try implementing this, I recommend the signal string system developed by the author of this mod in his other mod, https://github.com/justarandomgeek/factorio-signalstrings

"FOOBAR" = {signal-F=1,signal-O=6,signal-B=8,signal-A=16,signal-R=32}

F=1 means F is in the first position. O=2+4 means O is in positions 2 and 3. B=8 means B is in position 4. etc

This limits us to 32 character strings, but allows for repeated characters. More importantly, it would be compatible with any other mods and circuits using that system.

Lukesleftleg commented 2 years ago

Oh that does look handy, and using powers of two makes much more sense than my idea. (For example, how could you send two "L"s with different values using my idea?). I'll have a go, but like I say, I'm really very inexperienced with Factiorio modding, so if you've an idea for how to do it, then please go ahead. The functionality you suggest would certainly enhance this mod a lot. It's a great mod, but the alphabet nixies could be so much better. (32 characters is plenty for 99% of situations, but maybe you could double up comparators for more. It would still be a major improvement over one comparator per nixie to have only one per 32 nixies).

justarandomgeek commented 2 years ago

The main reason i never did this originally was that the performance of Alpha Nixies scales with the number of signals they are receiving, so it always seemed better to do the isolation of bits in combinators (it's a single & tucked below each nixie, which makes for a nice layout anyway) and only handle rendering them one by one.

Lukesleftleg commented 2 years ago

Oh really? Hmm, maybe it would be better to just make it an optional thing then. It would be a really great option to have. I can imagine all kinds of cool setups if you could pass strings to nixies, but if it has that much of a hit on UPS, then maybe it would be better as just an option. The kind you can turn on and off in settings.

justarandomgeek commented 2 years ago

I have a few other things i need to finish first but maybe it's worth doing some tests to see how bad it really is...

Lukesleftleg commented 2 years ago

Yeah, real life always gets in the way of the fun stuff. Fingers crossed for a low performance hit though, whenever you manage to clear the decks enough to give it a go. The best of luck with it, and thank you for what's already one of my must-have mods.