[This is a 1.1 save, migrated to 2.0. Using elevated rails & quality but not space age]
I have a compound entity which embeds a power switch which in turn is connected using a copper cable to a power network. When I inspect this in the debugger, the wire connection shows up like this:
The reported network id is "0". The API docs state: Index of a CircuitNetwork or ElectricSubNetwork which is going through this wire connector. Returns 0 if there is no network associated with this wire connector right now.
But there is a network associated with it (it is my main electrical network and if I click on the big electric pole, it will show me all the stats for the network).
Is the documentation wrong? I have connections where network id is > 0. Or should I use different information to determine whether the wire connector is actually connected (e.g. real_connection_count)?
[boskid][2.0.35] active electric network uses network_id == 0
Re: [2.0.35] active electric network uses network_id == 0
If possible please attach a save file with reference to this entity in storage.pole so i can investigate state of save file and of specific entity.
Re: [2.0.35] active electric network uses network_id == 0
Thanks for the report. Issue is now fixed for 2.0.36.
In this specific case issue was that LuaWireConnector returns incorrect value for the network_id when given copper wire connector: this value was 1 less than what LuaEntity::electric_network_id would report when it is connected to an electric network. In 2.0.36 this value will be increased by 1 so it matches value read by LuaEntity::electric_network_id and so a first electric network created in game will properly read network_id of 1. For a workaround you can use the LuaEntity::electric_network_id, but this workaround only works for electric poles, if you would happen to get a copper wire connector from a power switch then this workaround is not available.
In this specific case issue was that LuaWireConnector returns incorrect value for the network_id when given copper wire connector: this value was 1 less than what LuaEntity::electric_network_id would report when it is connected to an electric network. In 2.0.36 this value will be increased by 1 so it matches value read by LuaEntity::electric_network_id and so a first electric network created in game will properly read network_id of 1. For a workaround you can use the LuaEntity::electric_network_id, but this workaround only works for electric poles, if you would happen to get a copper wire connector from a power switch then this workaround is not available.
Re: [boskid][2.0.35] active electric network uses network_id == 0
thank you for the fix. I will update the mod to require 2.0.36 or newer once that has been released.
I currently use the real_connections_count as an indicator that there are connections and that works well.
I currently use the real_connections_count as an indicator that there are connections and that works well.