Idea
Per the title, the game would track statistics for each recipe. This could also be displayed in the game, or kept internal. Specifically, this would track n_batches_produced for each recipe, which would be how many output batches have been produced for a given recipe. So it would include outputs from productivity.Ideally, it would also track n_ingredient_batches for each recipe - how many batches of ingredients has actually been consumed for each recipe. Personally, I don't have a use for this statistic (yet, anyways), but if you're already adding a statistic for n_product_batches, it probably wouldn't be much harder?
Use case
I have a mod idea that would make recycling better able to handle items with multiple distinct recipes. Essentially, it would have one recycling recipe for each recipe that can produce an item, and would only enable the recycling recipe if more has been produced with the production recipe than has been recycled.I.e. recyclingRecipe.enabled = n_produced_recipe > n_consumed_recycling
Of course, the # of a recipe that's been performed would have to be multiplied by the # of the relevant item that's produced per cycle of the recipe, but that's fairly straightforward. Recycling (w/o mods) does not take productivity modules, so you can assume n_input_batches == n_recipe_cycles.
Currently, if I wanted such a statistic, I would need to iterate over all production machines every X ticks, look at what recipe each one has set and how many cycles it has completed since the last check. This would be both (potentially) slow, and inaccurate.
There would still be potential issues - planet-specific recipes for items, for example, which might never be produced on another planet. You probably don't want to recycle circuits on Fulgora and end up with tungsten plates, or something. But I think it's much easier to track cargo pods (since there are associated events), than to also iterate over all machine.
Edit:
Preferably, this statistic would also be planet-specific, like items and fluids already are.
For quality - the statistic would be quality-specific, as well; if a recipe produces a higher tier of quality, that would be counted under that higher quality's entry for that recipe. So if a recipe using common ingredients produces a legendary item, the legendary result would be counted for the legendary version of the recipe.
Edit(2):
I remembered that recipes are force-global. So I would need to add planet-specific versions of each recycling recipe, as well...(using surface conditions?)