What constitutes an electric network?
Posted: Wed Nov 11, 2020 3:09 pm
I want to burn small-electric-poles that carry power. Poles don't store energy, so they don't have the entity.energy property. But they can be connected, so we should be able to use entity.is_connected_to_electric_network(). But if I let this code
I get this output:
for this setup:
The two poles are in reach of the Active power source from Creative Mod, they are connected to each other, and they even have an active consumer (the lamp). In my opinion, this would qualify as an electric network -- but the test for is_connected_to_electric_network() fails. So, when is an electric network an electric network? 
Bonus question: Is there a way to read how much power goes over a wire?
Code: Select all
if ent and ent.type == "electric-pole" and ent.name == "small-electric-pole" then
log(string.format("%s (%s) is connected: %s\tNetwork ID: %s\tNeighbours: %s", ent.name, ent.unit_number, ent.is_connected_to_electric_network(), ent.electric_network_id, ent.neighbours["copper"]))
end
Code: Select all
small-electric-pole (34) is connected: false Network ID: 1 Neighbours: small-electric-pole

Bonus question: Is there a way to read how much power goes over a wire?