Page 1 of 1

[Rseding91] [2.0.55] Quality not accumulated in stats when using input_counts

Posted: Mon Jun 23, 2025 9:41 pm
by JustGoFly
Description
Quality is not inherently factored into standard input_count: When you use input_count on a decider combinator, it counts the total number of a specific item, regardless of its quality tier (Normal, Uncommon, Rare, etc.).

The code is written to load stats via:
local stats = force.get_item_production_statistics(getPlayerSurface(player))
The test below shows results for one player who complained that his science packs were not being counted correctly and shows 2000, when they are much higher. The manual test below show the bug.
The mod is Brave-New-Oarc and using the stats button in the gui, which runs lib/stats_gui.lua function buildStatsTable.

Results of test
stats.input_counts["space-science-pack"]
2000
⏱️ 0.077300ms
stats.get_input_count({name="space-science-pack", quality="normal"})
372000
⏱️ 0.034300ms
stats.get_input_count({name="space-science-pack", quality="uncommon"})
173000
⏱️ 0.027100ms
stats.get_input_count({name="space-science-pack", quality="rare"})
21000
⏱️ 0.024100ms
stats.get_input_count({name="space-science-pack", quality="epic"})
2000
⏱️ 0.029800ms
stats.get_input_count({name="space-science-pack", quality="legendary"})
0

Re: Quality not accumulated in stats when using input_counts

Posted: Mon Jun 23, 2025 9:47 pm
by Loewchen
Post the save and steps to reproduce it with, describe the results and what you expect instead and add the version of the game to the title please, see 3638.

Re: Quality not accumulated in stats when using input_counts

Posted: Mon Jun 23, 2025 10:28 pm
by JustGoFly
Sorry I missed this:

Factorio 2.0.55,
Save attached

Load and click OARC button in top left, then go to STAT tab, look at Science in drop down.
If running in debugger, put break in lib/stats_gui.lib line 192.
Break on player 4 - which is Pirion, he has made space-science-pack of each quality as shown in OP.
This uses the input_counts. The second method below is to enumerate same for player 4, for each quality to show the difference.

In game example commands:

/c game.print(game.players[4].force.get_item_production_statistics(game.players[4].surface).input_counts["space-science-pack"])

and for each quality setting to compare against above:
/c game.print(game.players[4].force.get_item_production_statistics(game.players[4].surface).get_input_count({name="space-science-pack", quality="normal"}))

Note that this mod only supports NAUVIS, so the accumulation is not done across planets, or tested across planets.

Re: [Rseding91] [2.0.55] Quality not accumulated in stats when using input_counts

Posted: Tue Jun 24, 2025 2:22 pm
by Rseding91
Thanks for the report. This is now fixed for the next release.