Linked Energy Sources/Script-Controlled Electric Networks

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

Hi. I wrote a long preamble for why I'd like this, which is in a spoiler block below for brevity.
TLDR - Linked connections for both items and fluids exist - and for items, have for a while
As of right now, there are only two aspects (that I can think of) of an entity that can't be linked in this manner: energy sources and heat connections. The latter can be addressed, as far as I know, through 1.1-style internal heat connections for compound entity applications. (but not for pseudo-underground heat pipes or cross-surface heat connections; those in theory can be hacked together with two assemblers creating a dummy fluid and two reactor prototypes consuming it using linked fluid boxes to connect them and a script to disable the reactors above a certain heat cap)

The former cannot. The best you can do right now is integrate a power pole into your compound entity and forbid placing power poles such that their connection area overlaps with the entity, or use linked connections to put all the energy source stuff on another surface. (which doesn't work if one of the components needs to be at the location of the compound entity... such as, say, a lightning rod)

So I propose the creation of a linked energy source type that functions as an electric energy source that only connects via control-stage script. This energy source would be available for prototypes anywhere an electric energy source is available. (maybe it should be a runtime thing or a property of electric energy sources?) For a full list, in case others are unaware, you can look at the api reference for ElectricEnergySources.

This would enable many things that aren't currently feasible without Lua scripting, hopefully in a less intrusive manner than, for example, adding fluid energy sources to entities that can only use void or electric energy inputs, or adding optional fluid/heat outputs to generator prototypes that don't already support them.
Example ideas enabled as compound entities by linked energy sources
Sorry for the huge write-up. I just had a thought and it kept going and going like a clown/magician pulling a chain of handkerchiefs out of their sleeve...
User avatar
BraveCaperCat
Filter Inserter
Filter Inserter
Posts: 430
Joined: Mon Jan 15, 2024 10:10 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by BraveCaperCat »

It doesn't make any sense for there to not be linked energy sources. I mean, there's already linked belts, linked containers/chests and linked fluid boxes/pipes, why not linked energy connectors? (or linked energy sources, receivers, etc)
Last edited by BraveCaperCat on Fri Jan 03, 2025 9:31 pm, edited 1 time in total.
Creator of multiple mods, including Quality Assurance - My most popular one.
Go check them out with the first and second links!
I'll probably be wanting or giving help with modding most of the time I spend here on the forum.
curiosity
Filter Inserter
Filter Inserter
Posts: 669
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by curiosity »

BraveCaperCat wrote: Fri Jan 03, 2025 9:11 pm It doesn't make any sense for there to not be linked energy sources. I mean, there's already linked belts, linked containers/chests and linked fluid boxes/pipes, why not linked poles? (or linked energy connectors, sources, etc)
Poles can already be linked. But the OP explicitly explains that poles aren't a solution and why.

Actually, what might help with the OP problem, if not linked energy sources, is electric network categories. Entities from different categories don't connect. It makes the power pole solution viable.
User avatar
BraveCaperCat
Filter Inserter
Filter Inserter
Posts: 430
Joined: Mon Jan 15, 2024 10:10 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by BraveCaperCat »

curiosity wrote: Fri Jan 03, 2025 9:23 pm
BraveCaperCat wrote: Fri Jan 03, 2025 9:11 pm It doesn't make any sense for there to not be linked energy sources. I mean, there's already linked belts, linked containers/chests and linked fluid boxes/pipes, why not linked poles? (or linked energy connectors, sources, etc)
Poles can already be linked. But the OP explicitly explains that poles aren't a solution and why.

Actually, what might help with the OP problem, if not linked energy sources, is electric network categories. Entities from different categories don't connect. It makes the power pole solution viable.
When I posted my reply, I hadn't read the actual original post. Instead, I read about it in a few sentences elsewhere, which linked here. Those few sentences (unlike the "quite a lot" amount of sentences used here) didn't explain that linked poles were different from linked energy sources or that they couldn't fulfil the same purposes.
Creator of multiple mods, including Quality Assurance - My most popular one.
Go check them out with the first and second links!
I'll probably be wanting or giving help with modding most of the time I spend here on the forum.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

curiosity wrote: Fri Jan 03, 2025 9:23 pm
BraveCaperCat wrote: Fri Jan 03, 2025 9:11 pm ...
Poles can already be linked. But the OP explicitly explains that poles aren't a solution and why.

Actually, what might help with the OP problem, if not linked energy sources, is electric network categories. Entities from different categories don't connect. It makes the power pole solution viable.
They are a solution, the issue is that the constraints on that solution are terribly awkward to work with and unintuitive for the player overall.

If you don't forbid electric network stuff near the compound machine with the power pole in it, then they may be confused, for example, when they see their boiler lightning rod (which is an idea that I had for a mod I intend to make that this would facilitate) drawing a ridiculous amount of energy because their power poles were placed too close. And if you do, you make it terribly inconvenient to work around the compound entity, which sucks.

Having the ability to set electric network 'layers' of sorts would also fulfill this feature request, though, you are right. (Hell, even just being able to override electric network connections for electric energy sources directly would cover it, tbh.)
User avatar
BraveCaperCat
Filter Inserter
Filter Inserter
Posts: 430
Joined: Mon Jan 15, 2024 10:10 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by BraveCaperCat »

braxbro wrote: Fri Jan 03, 2025 9:46 pm
curiosity wrote: Fri Jan 03, 2025 9:23 pm
BraveCaperCat wrote: Fri Jan 03, 2025 9:11 pm ...
Poles can already be linked. But the OP explicitly explains that poles aren't a solution and why.

Actually, what might help with the OP problem, if not linked energy sources, is electric network categories. Entities from different categories don't connect. It makes the power pole solution viable.
They are a solution, the issue is that the constraints on that solution are terribly awkward to work with and unintuitive for the player overall.

If you don't forbid electric network stuff near the compound machine with the power pole in it, then they may be confused, for example, when they see their boiler lightning rod (which is an idea that I had for a mod I intend to make that this would facilitate) drawing a ridiculous amount of energy because their power poles were placed too close. And if you do, you make it terribly inconvenient to work around the compound entity, which sucks.

Having the ability to set electric network 'layers' of sorts would also fulfill this feature request, though, you are right. (Hell, even just being able to override electric network connections for electric energy sources directly would cover it, tbh.)
What if you made a power pole with a connection radius of 0 and a supply area of 1? (or more if that's not enough, it just needs to be able to cover the combined entity)
Creator of multiple mods, including Quality Assurance - My most popular one.
Go check them out with the first and second links!
I'll probably be wanting or giving help with modding most of the time I spend here on the forum.
curiosity
Filter Inserter
Filter Inserter
Posts: 669
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by curiosity »

BraveCaperCat wrote: Fri Jan 03, 2025 10:25 pm What if you made a power pole with a connection radius of 0 and a supply area of 1? (or more if that's not enough, it just needs to be able to cover the combined entity)
It's not the power pole that's the problem, it's every other power pole with its own supply area.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

BraveCaperCat wrote: Fri Jan 03, 2025 10:25 pm
braxbro wrote: Fri Jan 03, 2025 9:46 pm ...
What if you made a power pole with a connection radius of 0 and a supply area of 1? (or more if that's not enough, it just needs to be able to cover the combined entity)
Entities can connect to multiple electric networks at once, and have no means of prioritizing between the two. This can be most easily seen by placing accumulators bridging two disconnected power networks; they serve as a sort of flow control for power between the two networks as one network charges them and the other draws from them. The receiving network(s) can never receive more than the accumulators can discharge, and the charging network(s) can never contribute more than the accumulators can accept.
protocol_1903
Filter Inserter
Filter Inserter
Posts: 286
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by protocol_1903 »

+1, I've run into similar issues with compound entities that a generic linked energy source like the one mentioned would solve
If you need to reach me, message me on discord.

I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
User avatar
BraveCaperCat
Filter Inserter
Filter Inserter
Posts: 430
Joined: Mon Jan 15, 2024 10:10 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by BraveCaperCat »

braxbro wrote: Fri Jan 03, 2025 10:41 pm
BraveCaperCat wrote: Fri Jan 03, 2025 10:25 pm
braxbro wrote: Fri Jan 03, 2025 9:46 pm ...
What if you made a power pole with a connection radius of 0 and a supply area of 1? (or more if that's not enough, it just needs to be able to cover the combined entity)
Entities can connect to multiple electric networks at once, and have no means of prioritizing between the two. This can be most easily seen by placing accumulators bridging two disconnected power networks; they serve as a sort of flow control for power between the two networks as one network charges them and the other draws from them. The receiving network(s) can never receive more than the accumulators can discharge, and the charging network(s) can never contribute more than the accumulators can accept.
Yeah, I'm not very good with control scripting. Or electricity management. (best I can do is set a reactor to stop receiving nuclear fuel when it has too high a temperature or there's already fuel)
Creator of multiple mods, including Quality Assurance - My most popular one.
Go check them out with the first and second links!
I'll probably be wanting or giving help with modding most of the time I spend here on the forum.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

Bumping this because it’d be very useful
Rseding91
Factorio Staff
Factorio Staff
Posts: 15962
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by Rseding91 »

I don’t understand how this would work. What would it mean when an entity has a “linked energy source”? What doesn’t link to? How does it interact with anything?
If you want to get ahold of me I'm almost always on Discord.
curiosity
Filter Inserter
Filter Inserter
Posts: 669
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by curiosity »

Rseding91 wrote: Wed Jul 30, 2025 1:37 am I don’t understand how this would work. What would it mean when an entity has a “linked energy source”? What doesn’t link to? How does it interact with anything?
I'm guessing linked electric sources and sinks. You have only yourselves to blame for this confusing terminology.
protocol_1903
Filter Inserter
Filter Inserter
Posts: 286
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by protocol_1903 »

For an actually helpful answer,

Energy sources as a separate entity prototype, that then connect to a 'linked energy source' for a specific entity, just like one connects linked belts, containers, and pipes. This energy source then provides power for that entity, with all of the normal restrictions.

Alternatively, though i doubt this implementation however cool it may be, multiple of the same linked energy source prototype can be linked so that all power/pull power from the same 'pool' of resources.
If you need to reach me, message me on discord.

I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

Rseding91 wrote: Wed Jul 30, 2025 1:37 am I don’t understand how this would work. What would it mean when an entity has a “linked energy source”? What doesn’t link to? How does it interact with anything?
I would just say make a new EnergySource type that can explicitly link to other sources, or add the functionality to do it directly to ElectricEnergySources.

The point of a linked energy source is to make an entity with an energy source that does not interact with player-built power networks - only script-defined ones. So you could, for example, place a lightning rod with a linked energy source next to a power pole and the network would get no power, but another entity linked to it by script would. The other entity also would not take power from the network.

Ideally, it'd be available anywhere the ElectricEnergySource is usable.

It interacts with things when those things are directly connected via script, akin to how linked chests, belts, and fluid boxes work. The whole point of this would be to enable more granular compound entity functionality while keeping the vanilla power network windows unaffected, among other use cases outlined in the OP.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15962
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by Rseding91 »

I'm still not understanding how it would actually function. When you say "link to an entity" exactly what does that mean? Does it mean "Entity A, with the linked energy source, will extract energy from entity B, the linked-to entity, when entity A needs to consume energy"? Because then what about entity B and it's energy source? In this example, if it's electric it would already be connecting to any nearby poles and working as normal to produce/consume electricity from the network. Or would it *also* be a linked energy source type - but then if it's not "linked to" anything where does it get any energy from/produce into?

That's what I'm missing. Just saying "linked energy source" means nothing in terms of energy sources without this defined.
If you want to get ahold of me I'm almost always on Discord.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

Rseding91 wrote: Thu Aug 07, 2025 12:11 pm I'm still not understanding how it would actually function. When you say "link to an entity" exactly what does that mean? Does it mean "Entity A, with the linked energy source, will extract energy from entity B, the linked-to entity, when entity A needs to consume energy"? Because then what about entity B and it's energy source? In this example, if it's electric it would already be connecting to any nearby poles and working as normal to produce/consume electricity from the network. Or would it *also* be a linked energy source type - but then if it's not "linked to" anything where does it get any energy from/produce into?

That's what I'm missing. Just saying "linked energy source" means nothing in terms of energy sources without this defined.
The idea is that you explicitly connect entities into a network, independent of player-placed electric networks. You say “Entity A, I’d like you to be connected to Entity B.” Then, Entity A and B are connected, and if A produces power, B can consume it (or vice versa). I could see either allowing them to be manually connected to electric networks or forcing them to go through an intermediate step to connect to them, but the whole point of the process is to create a system where Entity A and B can connect to each other WITHOUT connecting to an electric network placed around them unless configured to do so.

I would not expect the ability to connect linked energy sources to electric sources directly - ex. an assembler mooching off of a fusion reactor’s energy source. I would more expect the ability to connect linked energy sources to each other in a 1 to 1 or 1 to many configuration, and possibly allowing the option of connecting these script-controlled networks to existing networks by linking them to a power pole - however, this particular interaction is unnecessary and may be best left out for streamlining reasons, as you could simply make part of the compound entity not use a linked energy source to allow the compound entity to draw from or output to an electric network as normal.

In very short, I’d like to be able to create a ‘second layer’ of energy networks with these, where I control connections to the network on an entity-by-entity basis through script, so I don’t contaminate the first layer of power pole-based electric networks.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15962
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by Rseding91 »

I see. It’s not “linked to each other” linking, but essentially “electric energy source that uses its own network for power distribution”.
If you want to get ahold of me I'm almost always on Discord.
braxbro
Inserter
Inserter
Posts: 49
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Linked Energy Sources/Script-Controlled Electric Networks

Post by braxbro »

Rseding91 wrote: Thu Aug 07, 2025 2:13 pm I see. It’s not “linked to each other” linking, but essentially “electric energy source that uses its own network for power distribution”.
Right - but you control the connections directly.

Hence the second alternate name for the suggestion - 'script-controlled electric networks'. While I'm sure there's some SUPREME jank you could make with true linked energy sources (akin to linked chests/pipes where energy sources can become one-to-many w.r.t. entities) the actual use cases I could think of only need the ability to control connections to other energy sources (which is usually handled through an electric network for power distribution)

I suppose it's more like having an item output or fluid connection location on an entity that's within that entity's hitbox, so it dumps to another part of the compound entity instead of to the outside. That was the kind of conceptual role I was trying to describe.
Post Reply

Return to “Modding interface requests”