Page 1 of 1

Power Readout mod support

Posted: Tue Aug 22, 2017 7:12 am
by d3x0r
I saw a few power level based requests go by, and was thinking of building a power readout mod to support such requests, but I find the interface to electricity is fairly limited.

Sorry, this isn't a straight forward request, I don't really know what I would like to see entirely; I can really only present it as what I don't see.

1) there's no way to just get all electric networks on a surface
2) the only way to get an electric network is from a power-pole, and then from that there's no way to track what other things are really on that network. There are flow statistics, but that doesn't give me current levels of accumulators... and since there's no way to get other entities attached on the network, there's no way to get to the accumulators. (Although I suppose I can enumerate all entities, and pull all entities that have .electric_network_statistics (although the game crashes if I call that on an entity that is not a power-pole; and I haven't tried any other classes like say accumulator).

local stats = entity.electric_network_statistics;
local network = entity.get_circuit_network( 1, defines.circuit_connector_id.electric_pole );

network doesn't understand the wire type of copper, so I can't get circuit networks of power-poles.

3) There's no events I could identify that would be attach/dettach from network... that is if I remove a copper-wire from a power pole and/or re-add it, there's no events for that where I could track that that has become a separate network now. Would have expected to find an event like on_train_created that has a couple network IDs that can determine when a electric network is split/merged.


Also; I just wanted to define a button on the upper-left that I could click, as a sprite-button and ran into issues with that ( viewtopic.php?f=25&t=52077 )

Re: Power Readout mod support

Posted: Fri Nov 17, 2017 11:42 pm
by d3x0r
1) Please add a method to get all electric networks on a surface


2) provide information about accumulator charge in power network .

3) Add split/join electric network events similar to train attach/detach events.