Making entity electric flow fields writable
Making entity electric flow fields writable
Hi!
With the release of 0.16 I got right around to loading up my own mods to test them out. While fixing my mod https://mods.factorio.com/mods/Raeon/In ... 20Charging however, I found out that the LuaEntity::electric_input_flow_limit and LuaEntity::electric_output_flow_limit fields are no longer writable! With this change, I believe it is no longer possible to easily "draw X joules over Y ticks from a power network" from a mod script, meaning I now have to know the power draw beforehand in order to specify it in the entity prototype (or vary the amount of entities I spawn). Unfortunately, my mod has a quite sophisticated method of determining how much power should be drawn that makes it infeasible to do either of those things without losing functionality or lots of UPS.
I'd love to see any mechanic allowing me to reintroduce this behaviour- be it by making the aforementioned fields writable again, or through the introduction of another (couple of) field(s).
Thanks!
With the release of 0.16 I got right around to loading up my own mods to test them out. While fixing my mod https://mods.factorio.com/mods/Raeon/In ... 20Charging however, I found out that the LuaEntity::electric_input_flow_limit and LuaEntity::electric_output_flow_limit fields are no longer writable! With this change, I believe it is no longer possible to easily "draw X joules over Y ticks from a power network" from a mod script, meaning I now have to know the power draw beforehand in order to specify it in the entity prototype (or vary the amount of entities I spawn). Unfortunately, my mod has a quite sophisticated method of determining how much power should be drawn that makes it infeasible to do either of those things without losing functionality or lots of UPS.
I'd love to see any mechanic allowing me to reintroduce this behaviour- be it by making the aforementioned fields writable again, or through the introduction of another (couple of) field(s).
Thanks!
Re: Making entity electric flow fields writable
Those fields are no longer adjustable runtime due to an optimization around the electric network. It's not likely to change meaning you simply can't do that now.
If you want to get ahold of me I'm almost always on Discord.
Re: Making entity electric flow fields writable
There are other writable fields for the electric energy interface:
http://lua-api.factorio.com/0.15.40/Lua ... ity.energy
--edit: it might be UPS efficient to update the energy field once/second.
http://lua-api.factorio.com/0.15.40/Lua ... ity.energy
--edit: it might be UPS efficient to update the energy field once/second.
Re: Making entity electric flow fields writable
No worries about that- On default settings my mod only updates once per 15 ticks. Moreover, it can be reconfigured for an even lower interval if needed .CmdrKeen wrote:--edit: it might be UPS efficient to update the energy field once/second.
The problem is not so much accessibility in my case, but rather quality. If I would just go about setting a fixed size capacity of my interface (e.g. 100MJ) but cannot modify the flow speed at runtime, then I expect to receive spiking power graphs. As the input flow would be equal to the highest possible under any configuration within my mod (unlimited input flow), you would get really weird power spikes and brownouts in your power network due to suddenly high consumption, followed by zero when the buffer fills up .CmdrKeen wrote:There are other writable fields for the electric energy interface:
http://lua-api.factorio.com/0.15.40/Lua ... ity.energy
I actually experienced some problems manipulating power flow in 0.15 and posted a bug report a while ago regarding just that. When an energy consumer was receiving power greater than what a single type of provider could provide, it would apply the input flow limit once per type of provider, resulting in the energy consumer receiving more than it was allowed to per it's specified input flow. This consequently caused the internal buffer to fill up sooner than intended, causing the power usage to stop for an undefined amount of time depending on how much excess power was provided (see viewtopic.php?f=11&t=52516 for the full bug report).
I'm really glad the energy distribution was optimized and simplified, but on the other hand I'm really sad that this was accomplished at the cost of functionality. I was really hoping the issue would be resolved in 0.16 for good, but unfortunately for me the given solution defeats the purpose of solving the bug linked above.Rseding91 wrote:Those fields are no longer adjustable runtime due to an optimization around the electric network. It's not likely to change meaning you simply can't do that now.
I'm still eagerly looking for a way to fix my mod without creating spiky power graphs, so please let me know if there's a workaround or if some alternative functionality could be introduced to achieve the same effect .
Re: Making entity electric flow fields writable
The online API documentation still state the field to be modifiable, but only for entities of type energy-interface. Is that documentation in need of updating, or is the field being read-only for interfaces as well unintentional?Rseding91 wrote:Those fields are no longer adjustable runtime due to an optimization around the electric network. It's not likely to change meaning you simply can't do that now.
Re: Making entity electric flow fields writable
What online API documentation?Reika wrote:The online API documentation still state the field to be modifiable, but only for entities of type energy-interface. Is that documentation in need of updating, or is the field being read-only for interfaces as well unintentional?Rseding91 wrote:Those fields are no longer adjustable runtime due to an optimization around the electric network. It's not likely to change meaning you simply can't do that now.
If you want to get ahold of me I'm almost always on Discord.
Re: Making entity electric flow fields writable
http://lua-api.factorio.com/latest/LuaE ... flow_limitRseding91 wrote:What online API documentation?Reika wrote:The online API documentation still state the field to be modifiable, but only for entities of type energy-interface. Is that documentation in need of updating, or is the field being read-only for interfaces as well unintentional?Rseding91 wrote:Those fields are no longer adjustable runtime due to an optimization around the electric network. It's not likely to change meaning you simply can't do that now.
Re: Making entity electric flow fields writable
Ah thanks, I've fixed them for 0.16.12.
If you want to get ahold of me I'm almost always on Discord.
Re: Making entity electric flow fields writable
The documentation is unchanged; does that mean the fields should in fact be writable for these entities (contrary to what was implied earlier)?Rseding91 wrote:Ah thanks, I've fixed them for 0.16.12.
Re: Making entity electric flow fields writable
0.16.12 isn't out yet.Reika wrote:The documentation is unchanged; does that mean the fields should in fact be writable for these entities (contrary to what was implied earlier)?Rseding91 wrote:Ah thanks, I've fixed them for 0.16.12.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Making entity electric flow fields writable
I have to sadly agree with the OP. This completely breaks the ability to use the EEI for dynamic power consumption without producing brownouts or even blackouts.Rseding91 wrote:Those fields are no longer adjustable runtime due to an optimization around the electric network. It's not likely to change meaning you simply can't do that now.
I previously had a working reverse-power relay (a one way power transfer system) that was completely circuit controllable. The only way to achieve any amount of granularity in the power transferred without changing the flow_limit runtime would be to generate a huge amount of entities (i.e. thousands) in the data stage and die/spawning them in as required. As the only other still writeable alternatives of power_production/consumption would completely mess up the power statistics (unless it's possible to make EEI buffers not be counted into the networks total accumulator capacity... should i write a request for that?)
TL;DR:
Bleh. Headache.
PS:
@OP: In a purely comsumption situation (if that is your case) you might actually be able to spawn the EEI with a full energy buffer and then use power_consumption for the desired effect.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Inserter
- Posts: 29
- Joined: Wed Apr 29, 2020 9:53 pm
- Contact:
.electric_input_flow_limit read/write?
I run a multiplayer scenario (softmod) in which it would be convenient to modify this value for LuaEntity. I notice in the past, in 0.15, it was writable.
Is this something easy to make writable again, or does that have complications?
Is this something easy to make writable again, or does that have complications?
Re: .electric_input_flow_limit read/write?
I have no idea what you are talking about 0.15. There was a note saying it was only writable for ElectricEnergyInterface. Right now to change ElectricEnergyInterface paramters there are power_production and power_usage. Main limitation for making it writable for all entities is that it is not part of the entity state but the value on read comes directly from the energy source prototype which can only be changed in data stage.
Re: Making entity electric flow fields writable
Merged with an older topic.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
-
- Inserter
- Posts: 29
- Joined: Wed Apr 29, 2020 9:53 pm
- Contact:
Re: Making entity electric flow fields writable
Thanks for the reply.
My scenario runs scripts based on charge delivered to a rocket silo, but even with installing 4x Prod 3 modules, and removing all energy from the silo energy bugger every tick, the fixed electric_input_flow_limit means it can still only draw a maximum of 18MW.
It's a bit difficult to place other entities for players to charge in a way that makes sense. I think doing this via accumulators/EEIs doesn't work too well, because (last time I checked was over a year ago), accumulators have low priority in the network and it's inconvenient in my scenario for them to be powered last over everything else.
If there aren't any simple things I'm missing, I'll either wait for more modding interface, or try to think how to rework the 'charge point' to include more entities.
My scenario runs scripts based on charge delivered to a rocket silo, but even with installing 4x Prod 3 modules, and removing all energy from the silo energy bugger every tick, the fixed electric_input_flow_limit means it can still only draw a maximum of 18MW.
It's a bit difficult to place other entities for players to charge in a way that makes sense. I think doing this via accumulators/EEIs doesn't work too well, because (last time I checked was over a year ago), accumulators have low priority in the network and it's inconvenient in my scenario for them to be powered last over everything else.
If there aren't any simple things I'm missing, I'll either wait for more modding interface, or try to think how to rework the 'charge point' to include more entities.