[0.17.68] Some equipment prototype energy sources report incorrect buffer_capacity

Bugs that are actually features.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

[0.17.68] Some equipment prototype energy sources report incorrect buffer_capacity

Post by eradicator »

What?
Fusion reactor and exoskeleton report different sizes for buffer_capacity and max_energy. Noticibly these are the only two prototypes that have buffer_capacity 0 in base game.

Details

Data (optional):

Code: Select all

for k,v in pairs(data.raw) do if k:match'equipment$' then for _,y in pairs(v) do
  y.energy_source.buffer_capacity = "1TJ"
  end end end
Control:

Code: Select all

/c
for k,v in pairs(game.player.get_inventory(defines.inventory.character_armor)[1].grid.equipment) do 
  print(v.name,v.prototype.energy_source.buffer_capacity,v.max_energy)
  end
Result (Vanilla):

Code: Select all

fusion-reactor-equipment        0       12500
energy-shield-equipment 120000  120000
energy-shield-mk2-equipment     180000  180000
battery-equipment       20000000        20000000
exoskeleton-equipment   0       33333.333333333
personal-roboport-equipment     35000000        35000000
personal-roboport-mk2-equipment 35000000        35000000
night-vision-equipment  120000  120000
battery-mk2-equipment   100000000       100000000
Result (1TJ Buffer):

Code: Select all

fusion-reactor-equipment        1000000000000   12500
energy-shield-equipment 1000000000000   1000000000000
energy-shield-mk2-equipment     1000000000000   1000000000000
battery-equipment       1000000000000   1000000000000
exoskeleton-equipment   1000000000000   33333.333333333
personal-roboport-equipment     1000000000000   1000000000000
personal-roboport-mk2-equipment 1000000000000   1000000000000
night-vision-equipment  1000000000000   1000000000000
battery-mk2-equipment   1000000000000   1000000000000
Expected Result
buffer_capacity and max_energy should always be equivalent, preferably by supporting buffer_size override on the last two equipment types.
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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16098
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.68] Some equipment prototype energy sources report incorrect buffer_capacity

Post by Rseding91 »

Thanks for the report however that's working correctly.

The buffer_capacity for both of those are dynamically set at equipment creation time based off the values of the given equipment.

For generators it's the power they produce per tick. For exo-skeletons it's the energy consumption * 10.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.17.68] Some equipment prototype energy sources report incorrect buffer_capacity

Post by eradicator »

Rseding91 wrote: Thu Sep 12, 2019 7:27 pm Thanks for the report however that's working correctly.

The buffer_capacity for both of those are dynamically set at equipment creation time based off the values of the given equipment.

For generators it's the power they produce per tick. For exo-skeletons it's the energy consumption * 10.
Can't their respective energy_source prototypes be at least made to report that same value? As it stands anybody who doesn't know this quirk and relies on the prototype data (instead of max_energy) will get the wrong numbers.

I'm not saying that the dynamic consumption is a bug. I'm saying that the two numbers are different is a bug.
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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16098
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.68] Some equipment prototype energy sources report incorrect buffer_capacity

Post by Rseding91 »

I don't consider it worth making them do that. Most entities use the same runtime dynamic buffer size based off their maximum energy demands. For example: assembling machines need more power if you speed module them and so their buffer size changes when under the effects of speed modules. That's impossible to reflect through the prototype alone.

Making equipment do that just because it is possible won't help the overall situation and just serve as another point of confusion. buffer_size in an entities energy source prototype definition should be default ignored until it's shown that it's directly used by the entity. For example: accumulators, and laser turrets.

In most cases it's meaningless.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.17.68] Some equipment prototype energy sources report incorrect buffer_capacity

Post by eradicator »

Rseding91 wrote: Thu Sep 12, 2019 8:03 pm buffer_size in an entities energy source prototype definition should be default ignored until it's shown that it's directly used by the entity. For example: accumulators, and laser turrets.

In most cases it's meaningless.
Hm. How about reflecting that particular bit of information in the API doc then? The page on LuaElectricEnergySourcePrototype is currently almost empty.
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 “Not a bug”