Page 1 of 1

[raiguard][2.0.69] Fluids get voided, even when switching to compatible recipe

Posted: Sun Oct 12, 2025 12:47 am
by Gotbread
1. What did i do?

Created a mod with 2 recipes, both have the same fluid input:

Code: Select all

        ingredients =
        {
            {type = "fluid", name = "crude-oil", amount = 10},
            {type = "fluid", name = "water", amount = 10},
        },
and different outputs (one makes an iron plate, another makes a copper plate, so i can quickly see the output).
Now i switch between them:
- manually via the GUI: clicking the "change recipe" button, select the other recipe, observe that the machine is now assembling the new recipe
- via set_recipe in the console
- via set_recipe in my control.lua script

2. What happened?

The plant switches to the new recipe, aborting the progress, and also voiding both fluid ingredients. Each time i switch, it voids more fluid.

3. What did you expect to happen?

I expect that the fluid gets pushed back to the fluid network (there is space to absorb it).
This is related to this issue:
viewtopic.php?p=599670#p599670
relevant part:
It works this way so fluid for a given recipe gets re-used for the next one if they are acceptable.
The new recipe is compatible with the old one (it uses the exact 2 same fluid inputs and no item input), and yet, the fluid is voided. It is not pushed back or reused.

4. Does it happen always?
Yes, both with the stable version, and also the experimental (2.0.69 (build 84148 expansion, linux 64))

My 2 cents:
I agree that handling this case *in general* is tricky. But in the case that both recipes are 1-to-1 compatible on the input, voiding the liquid is not needed, so it would be nice if we can keep the liquid (or have a workaround in the script/recipe to allow for such behaviour).

Setup:
Bildschirmfoto vom 2025-10-12 02-40-47.png
Bildschirmfoto vom 2025-10-12 02-40-47.png (1.02 MiB) Viewed 619 times
switching between the 2 recipes was done manually, and also with the console command /c game.player.selected.set_recipe("s1") and /c game.player.selected.set_recipe("s2")

(Logfile attached)

Re: [raiguard][2.0.69] Fluids get voided, even when switching to compatible recipe

Posted: Mon Oct 27, 2025 5:18 pm
by raiguard
Thanks for the report, this has been fixed for version 2.1.0.

This bug has actually existed for many years, even before the fluids rewrite, but nobody noticed it until now!

Re: [raiguard][2.0.69] Fluids get voided, even when switching to compatible recipe

Posted: Mon Oct 27, 2025 10:21 pm
by zig1000
Note: It sounds like this solves the fluid case of viewtopic.php?t=118708

It'd be nice/consistent if solids got a similar change to stay in the ingredients slot for compatible recipes.

Re: [raiguard][2.0.69] Fluids get voided, even when switching to compatible recipe

Posted: Wed Nov 05, 2025 9:12 pm
by mrvn
The fluids aren't simply voided. At least for a recipe with item and fluid input in 2.0.69 the fluids are pushed back into the fluid system up to the amount it has space for. If you connect a tank to each input you can see that all the fluids present in the assembler end up in the tank when you change the recipe. And when you set the new recipe the fluid flows back into the assembler.

It's just annoying that the fluid has to flow back into the assembler. For recipes with a large fluid amount this can take some time if the buffer tanks are near empty as the flow rate depends on the fullness of the tank. So care must be taken that the buffer tanks are never full or empty to achieve good throughput without waste when switching recipes.


Did you maybe confuse this with changing recipes where the input changes fluid types? I think that is when stuff gets voided rather than risking putting a fluid into the wrong pipe.