[Lua][feature] event for circuit network modification

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Asynchron
Burner Inserter
Burner Inserter
Posts: 19
Joined: Fri Dec 02, 2022 9:10 pm
Contact:

[Lua][feature] event for circuit network modification

Post by Asynchron »

Hi team, and everyone,

So I've been working on a pet mod for myself, which tries to employ circuit networks to do discovery of entities that should interact between themselves. The problem here is: there is no event that can notify my mod if a circuit network has changed, where by change I mean addition/removal/swap of an entity in the network.

At current moment I'm forced to do polls over all circuits I'm using for discovering if it was modified or not. This involves quite a lot of checkups, O(n^2) of operations since I need to check if new set of entities is same as old set that is kept in mod memory.

I think this would be a beneficial addition since this will eliminate any heavy comparisons being done in mod itself, as well as removing any delay between circuit modification and actual detection of said change.

There could be a new event similar to (pseudo syntax: name(params)):

Code: Select all

on_network_circuit_changed(circuit_network_id: number, added: entity[], removed: entity[])
P.S. This also can benefit other existing mods like LTN, or crafting combinator, improving their speed.

Best regards,
Alexandru.
Post Reply

Return to “Modding interface requests”