Page 1 of 1

Don't return zero-value signals in get_merged_signals

Posted: Sun Jul 07, 2024 4:07 am
by scruffyvoltherder
Instead of returning a signal with a count of 0, could get_merged_signals() instead leave the signal out of the list, and if there aren't any non-zero signals, just return nil?
zero_signal.png
zero_signal.png (48.42 KiB) Viewed 321 times
My idea to detect changes is to have the iopoint linked to a lamp on a hidden surface, and the lamp would have a constant combinator connected to it with the other color of wire. Whenever a signal comes in, the mod will detect when get_merged_signals !=nil. The constant combinator would then negate the signal at the lamp so that the merged signal is once again nil.
change_detection.png
change_detection.png (959.52 KiB) Viewed 321 times

Re: Don't return zero-value signals in get_merged_signals

Posted: Mon Jul 08, 2024 11:21 am
by Stringweasel
If you're looking for an (relatively) easy way to detect curcuit events look at what this mod does: https://mods.factorio.com/mod/glutenfre ... ork-events

Re: Don't return zero-value signals in get_merged_signals

Posted: Thu Jul 11, 2024 2:05 pm
by boskid
Implemented for 2.0: get_signals [due to rename] will not return signals with value of 0.