I'm writing a recycling mod that reverses recipes, so I need to know what all the recipes are in a running game.
How can my mod know when other mods have added recipes? Or, how can I make my mod load last so I can read all the recipes, knowing that no more will be added?
[SOLVED] How to know all recipes
[SOLVED] How to know all recipes
Last edited by DRY411S on Wed Jun 01, 2016 7:00 pm, edited 1 time in total.
Re: How to know all recipes
Well as i know all receipes are listed in game.force.receipes
http://lua-api.factorio.com/0.12.34/Lua ... ml#recipes
Greetings steinio
http://lua-api.factorio.com/0.12.34/Lua ... ml#recipes
Greetings steinio
Re: How to know all recipes
Thanks.
But how do I know that that is fully populated when I read it, and all the other mods recipes have been added?
* Sorry if that's a noob modder question, because I am a noob modder
But how do I know that that is fully populated when I read it, and all the other mods recipes have been added?
* Sorry if that's a noob modder question, because I am a noob modder

- ArderBlackard
- Long Handed Inserter
- Posts: 74
- Joined: Thu May 05, 2016 12:41 pm
- Contact:
Re: How to know all recipes
There are three iterations of prototypes definition for all the mods: first 'data.lua' are run for all mods (if present), then 'data-updates.lua' scripts are run, then the same is done for 'data-fnal-fixes.lua'. Most of the mods define their prototypes in 'data.lua' files. You probably should consider using 'data-final-fixes.lua' in your mod - it's very likely all other recipes will be defined at the time it will be loading.
You may read about more details on wiki: https://wiki.factorio.com/index.php?tit ... _Lifecycle.
You may read about more details on wiki: https://wiki.factorio.com/index.php?tit ... _Lifecycle.
Gib dich hin bis du Glück bist
Re: How to know all recipes
That's an interesting and useful link, thank you.ArderBlackard wrote:There are three iterations of prototypes definition for all the mods: first 'data.lua' are run for all mods (if present), then 'data-updates.lua' scripts are run, then the same is done for 'data-fnal-fixes.lua'. Most of the mods define their prototypes in 'data.lua' files. You probably should consider using 'data-final-fixes.lua' in your mod - it's very likely all other recipes will be defined at the time it will be loading.
You may read about more details on wiki: https://wiki.factorio.com/index.php?tit ... _Lifecycle.
I'm starting to think now that I will use the on_research_finished event. Each recycling recipe will only become enabled when the equivalent crafting recipe is unlocked by research, and my mod only starts working when Automation has been researched, so I can initialise all the enabled recipes on the event when LuaTechnology.name = "automation", and then add new recycling recipes as the other research progresses.
Re: How to know all recipes
To avoid starting another topic about recipes...
Is it possible to have more than one recipe with the same name, but perhaps other different elements like ingredients categories or results?
Or is a recipe 'name' unique, like a primary key on a database table?
Is it possible to have more than one recipe with the same name, but perhaps other different elements like ingredients categories or results?
Or is a recipe 'name' unique, like a primary key on a database table?
- ArderBlackard
- Long Handed Inserter
- Posts: 74
- Joined: Thu May 05, 2016 12:41 pm
- Contact:
Re: How to know all recipes
Exactly. A recipe name should be unique.DRY411S wrote:Or is a recipe 'name' unique, like a primary key on a database table?
Gib dich hin bis du Glück bist