Page 1 of 1

EquipmentPrototype states energy_source as ElectricEnergySource but it can be different - No, just confusing

Posted: Tue Nov 21, 2023 8:29 pm
by Soul-Burn
The EquipmentPrototype page shows energy_source specifically as ElectricEnergySource rather than a generic EnergySource.

Some mods, e.g. Jetpack successfully use a battery equipment with an energy_source of type = "void".

There are many other places where energy_source is set to specific sources. Worth looking over those as well.

Re: EquipmentPrototype states energy_source as ElectricEnergySource but it can be different

Posted: Tue Nov 21, 2023 8:40 pm
by Bilka
It's getting loaded as an electric energy source. When the energy source is directly loaded as one of the subtypes (NOT via EnergySource or another union type), the "type" is ignored, regardless of whether it is correct or incorrect.

I'll consider this post an indication to improve https://lua-api.factorio.com/latest/typ ... .html#type to mention that not only it's not mandatory, is completely ignored when the energy source is loaded directly as a ElectricEnergySource.

See also viewtopic.php?p=595871#p595871.

Re: EquipmentPrototype states energy_source as ElectricEnergySource but it can be different - No, just confusing

Posted: Tue Nov 21, 2023 8:48 pm
by boskid
Jetpack creates equipment specifying `energy_source.type = "void"` but game ignores this field as it is implemented to only ever load electric energy source (there is no need to specify type if there is nothing to choose from). This is why jetpack also specifies `usage_priority` as otherwise the electric energy source would not load. You can verify that jetpack has electric energy source by opening Prototype Explorer GUI (Ctrl+Shift+E) and in equipment search for jetpack: energy source prototype is marked as type `unique_ptr<ElectricEnergySourcePrototype>`, it literally does not accept any other energy source type.

Re: EquipmentPrototype states energy_source as ElectricEnergySource but it can be different - No, just confusing

Posted: Tue Dec 05, 2023 4:55 pm
by Bilka
Bilka wrote:
Tue Nov 21, 2023 8:40 pm
I'll consider this post an indication to improve https://lua-api.factorio.com/latest/typ ... .html#type to mention that not only it's not mandatory, is completely ignored when the energy source is loaded directly as a ElectricEnergySource.
Done for the next version for BurnerEnergySource and ElectricEnergySource.