Electric Energy interface -> [R/W] overall_satisfaction

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Electric Energy interface -> [R/W] overall_satisfaction

Post by eradicator »

What?
Make a consuming EEI remember it's lifetime average satisfaction.

Why?
Making entities with custom behavior that also continuously consumes energy to execute this behavior currently requires to make one of several annoying compromises:
  1. Consume energy from the buffer every tick -> high UPS cost
  2. Use a larger buffer and only consume every n ticks -> ugly huge spikes in the energy graph and incorrect behavior if the player does not have enough accumulators to catch the spikes
  3. Set the EEI to consume energy per tick -> no way to tell if the EEI is getting 100% satisfaction
3) being the main problem that might be solvable. My assumption here is that any such behavior is only realistic UPS cost wise using on_nth_tick, which requires some way to determine satisfaction between nth_tick calls.

If the EEI remembered the total consumed energy it would be trivial to compare the expected total with the actual total, but ofc this requires storing a quite large number in the entity and is thus unlikely to happen i guess. So the second possiblity i can come up with is for the EEI to calculate an average of it's overall satisfaction. This is still extra entity data but only a simple float. The nth_tick handler could then reset the value back to 1 to get the satisfaction between nth_ticks.
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.

Post Reply

Return to “Modding interface requests”