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},
},
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:
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.It works this way so fluid for a given recipe gets re-used for the next one if they are acceptable.
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: 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)