Don't return zero-value signals in get_merged_signals

scruffyvoltherder
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Jun 14, 2024 12:33 am
Contact:

Don't return zero-value signals in get_merged_signals

Post 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 426 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 426 times
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 416
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

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

Post 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
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3031
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post by boskid »

Implemented for 2.0: get_signals [due to rename] will not return signals with value of 0.
Post Reply

Return to “Implemented mod requests”