Page 1 of 1

[2.0.15] Productivity resets when switching recipes in production building

Posted: Sun Nov 10, 2024 3:49 pm
by TornadoFS
When switching a recipe using the "Set Recipe" circuit logic in a production building the productivity bar (the purple bar) inside the building resets back to 0 even if you switch back to the first recipe, it would be nice if the building remembered the productivity level it had when switching back to a recipe it has ever had before.

For example:
Building is at productivity 60% making item A
Circuit switches building to item B
Circuit switches building back to item A
Productivity bar is set back to 0%


This is especially important in the Eletromagnetic Plant because of its built-in 50% productivity, with this bug it essentially means wasting productivity when trying to reuse an Eletromagnetic Plant for multiple recipes (like having a single EM making multiple different modules which was the problem I personally ran into)


For example in this build, the EM switches recipe (between Quality Module 1/2/3) based on the contents of the requester chest, every time it switches I lose the productivity bar. It took me hours to realize I was wasting tons of high-quality materials
11-10-2024, 17-11-06.png
11-10-2024, 17-11-06.png (2.58 MiB) Viewed 680 times

Re: [2.0.15] Productivity resets when switching recipes in production building

Posted: Sun Nov 10, 2024 4:41 pm
by Rseding91
This is not a bug and specifically was programmed to work this way.

Re: [2.0.15] Productivity resets when switching recipes in production building

Posted: Mon Nov 11, 2024 8:42 am
by TornadoFS
Hi thanks for answering, just to make sure you understand what I pointed out.

The problem is not that the productivity bar resets when a recipe is switched
The problem is that when switched back to the original recipe the productivity bar is not restored back to its original value for that recipe
The solution is to have the productivity bar state be stored individually for each recipe

This is particularly bad when using the "Set Recipe" circuit logic with Eletromagnetic Plants because they have built-in +50% productivity. For other buildings it only matters if you have productivity modules and rarely that is the case when "Set Recipe" is used (usually those kind of circuits are part of quality-module production chains).

I have a very complex combinator setup for building stuff in Eletromagnetic Plants and it is basically wasting its 50% productivity when recipes switch, I would need to work around this by adding a "always build 2 of something before switching recipes" circuit logic which would increase the complexity quite a lot more.

I would say this is definitely a bug, but I understand if it is deemed not worth the effort given how niche its use case is and the potential for memory leaks.

Re: [2.0.15] Productivity resets when switching recipes in production building

Posted: Mon Nov 11, 2024 1:08 pm
by Rseding91
Yes that is intended. When the recipe changes the productivity bar is cleared and is not saved.