Event to notify when fluid segments are created or destroyed

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
half a cat
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sun Jul 16, 2023 4:03 pm
Contact:

Event to notify when fluid segments are created or destroyed

Post by half a cat »

Please make an event that is sent when a fluid segment has been created or destroyed, with enough information so that mods can find which entities are affected.

This is so that mods can watch the contents of pipes. Call a Plumber does this by periodically checking contents of individual entities. To limit overhead, it only checks a few entities per tick, and it can take several minutes to check all pipes in the game. I've considered watching fluid segments instead, but it was too difficult to track which fluid entities exist.

The new 2.1 changes make it impossible for mods to detect when fluid segments change, as far as I can tell, since no event is produced when a mixed fluid pipe becomes unmixed and its fluid segments merge.

Here is my idea for what information to include with the event. It could include the old fluid segment IDs, the new fluid segment IDs, and one fluid box from each of the new fluid segments. This works for fluid segment creation, deletion, merging, and splitting. The fluid boxes allow a mod to access the fluid segments, since they can't be accessed by their ID alone.
Post Reply

Return to “Modding interface requests”