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

Gotbread
Inserter
Inserter
Posts: 30
Joined: Wed Mar 11, 2015 11:14 pm
Contact:

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

Post 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 552 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)
Attachments
factorio-current.log
(10.05 KiB) Downloaded 19 times
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 773
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

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

Post 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!
Don't forget, you're here forever.
zig1000
Inserter
Inserter
Posts: 37
Joined: Fri Oct 25, 2024 9:57 pm
Contact:

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

Post 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.
mrvn
Smart Inserter
Smart Inserter
Posts: 5998
Joined: Mon Sep 05, 2016 9:10 am
Contact:

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

Post 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.
Post Reply

Return to “Fixed for 2.1”