Page 1 of 1

[1.1.104] burner-generator entity type shows up as power consumer and producer

Posted: Wed Feb 28, 2024 6:54 am
by protocol_1903
Issue
Any entity of the type "burner-generator" shows up as an electricity consumer as well as producer. This was tested with primary and secondary priority output. Mods tested were an indev mod attached below as well as AAI Industry [0.5.22].
Below are two images depicting the issue. One with fuel in the entities, one without fuel in either entity. Note, the engine item icon is the temporary icon for the burner-generator for my mod.
Screenshot 2024-02-27 233831.png
Screenshot 2024-02-27 233831.png (101.22 KiB) Viewed 438 times
Screenshot 2024-02-27 233957.png
Screenshot 2024-02-27 233957.png (110.11 KiB) Viewed 438 times
Replication
1. Open the most recent version of Factorio
2. Install AAI Industry, or the attached zip.
3. Reload Factorio with the mod(s)
4. Create a new sandbox game
5. Place down the indicated generator
6. Connect it to an electrical network
7. Open the electrical network

Re: [1.1.104] burner-generator entity type shows up as power consumer and producer

Posted: Mon Mar 11, 2024 12:10 pm
by boskid
This is really strange. BurnerGenerator technically has 2 energy sources, one is Burner to consume fuel and second is Electric which works in reverse (provides energy to electric network). From the BurnerGenerator point of view it declares both maximumPowerOutput (because of Electric) and maximumPowerConsumption (because of Burner) so the tooltip is correct [without maximumPowerConsumption it would not be showing that it burns fuel], however electric network gui has a special check called "putItThereEvenWhenUsageIsZero". In case of the consumption column it uses maximumPowerConsumption declared by the prototype which for BurnerGenerator is positive so it is forced to show even when it does not consume electric energy.

From BurnerGenerator point of view, maximumPowerConsumption being for burner is correct. From the electric network gui point of view maximumPowerConsumption is treated as part of electric source and the gui behavior is correct. Yet when they are combined they do not work.

I did a check if this is already fixed for 2.0 and to my surprise it seems to be working fine here but for a completly different reason: flow statistics are no longer stored in a flat vector but instead are stored in maps from entityID and if an entity never consumed anything (does not appear in the flow statistics) it is not showing even when "putItThereEvenWhenUsageIsZero" would be true just because given entityID is not visited if there are no mapping records. So 2 bugs combined cancel each out. Crazy.

Re: [1.1.104] burner-generator entity type shows up as power consumer and producer

Posted: Mon Mar 11, 2024 6:34 pm
by protocol_1903
That is... strange to say the least. I cant say I've ever heard of a bug cancelling another bug in such a way. It makes sense why it took so long, I was wondering if I would ever hear back :) Thanks for the explanation!