I'm trying to make a mod which uses multiple surfaces as "floors" and I want to be able to transport things between floors. I've been using the very neat Factorissimo code as a reference for some general strategies for this and I have a working implementation for items and liquids, but electricity is proving tricky.
Factorissimo handles electricity by having the "factory" building be a roboport, which causes the game engine to charge the roboport's energy buffer, and then it reflects the state of that buffer into an accumulator inside the factory to be the energy source for machines inside the factory. This makes sense and works fine for Factorissimo because the type of the building isn't particularly important, and each building is connected to just one surface. It looks like it does the reverse for power generation buildings.
This means you have to decide a fixed "direction" that power can flow for each connection, and there's also no way to see "global" power stats since each surface has its own electric network. Are there any other strategies for transferring power between surfaces that people know of, or have been used in other mods? I suspect it's not possible in the current game engine to have this work "perfectly", but any alternative suggestions would be interesting to compare the upsides and downsides.
Strategies for moving electricity between surfaces?
Re: Strategies for moving electricity between surfaces?
The game doesn't allow different surfaces to connect electric energy sources. They're specifically coded to only work with one surface.
If you want to get ahold of me I'm almost always on Discord.
Re: Strategies for moving electricity between surfaces?
Yeah, I guessed that was probably the case looking at the API - thanks for confirming it. So, I'm just curious what other hacky workarounds people might have thought of other than the method Factorissimo uses
Re: Strategies for moving electricity between surfaces?
You can made two accumulators, one have input only, second have output only. Take the energy from first and set in the second with simple script.
Re: Strategies for moving electricity between surfaces?
Using electrical-energy-interface entity. It's a similar to accumulator, except that it also allows changing power generated/consumed dynamically. So via LUA one can consume power at one such entity and produce it in another.torne wrote:Yeah, I guessed that was probably the case looking at the API - thanks for confirming it. So, I'm just curious what other hacky workarounds people might have thought of other than the method Factorissimo uses
A while back I made a mod as a proof of concept of sorts:
https://mods.factorio.com/mods/Yoyobuae ... ransformer
The electric network window still shows it as the producer/consumer though (no way around that). The benefit is that the power used at the consuming side is reflected back into the producer side. It's a bit tricky to ensure energy is not created/destroyed in the process, but I think my code should work correctly.
-
- Manual Inserter
- Posts: 1
- Joined: Thu Jan 18, 2024 6:45 pm
- Contact:
Re: Strategies for moving electricity between surfaces?
fyi for anyone lost in old forums this is now possible just run connect_neighbor onto another pole on the other surface