Page 1 of 1

Event for on_pre_recipe_changed / on_recipe_changed

Posted: Fri Oct 11, 2019 10:52 am
by JoeyDP
For my mod https://mods.factorio.com/mod/better-air-filtering I could use a callback for when the recipe of a crafting machine changes. Specifically for detecting when fluid that is in the machine will be destroyed. The added machines contain a representation of pollution in liquid form, and need to release it back into the atmosphere to prevent loopholes. The only scenario I know of where liquid can still be destroyed without a callback, is when the recipe is changed from the GUI.

Currently I use one fixed recipe per machine to prevent this, which is rather limiting toward my future plans.

Let me know if I maybe missed this feature. Or if you like this idea, give it a bump :).

Re: Event for on_pre_recipe_changed / on_recipe_changed

Posted: Fri Nov 29, 2019 6:27 pm
by raiguard
I would also love this. I wish to add snapping logic to infinity pipes so that if they're placed next to an assembler, they can automatically be set to provide the correct fluid. I can do this when the pipe is placed, but not when the recipe is changed.

Image

Without a recipe changed event, the only way I can think of to do this would be to check every assembling machine on every tick of the game. That would get bad very quickly!

Recipe changes usually only ever happen manually, so adding an event for it wouldn't cause any performance overhead on large save files, I think.

Re: Event for on_pre_recipe_changed / on_recipe_changed

Posted: Fri Nov 29, 2019 6:49 pm
by darkfrei
+1