Procedural prototype name migrations

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Malidictus
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sat Jan 18, 2020 11:24 pm
Contact:

Procedural prototype name migrations

Post by Malidictus »

In updating Alchemistry, I ran into the issue of having to update the prototype names of procedurally-generated recipes. The recipe list is generated from resources potentially added by other, unknown mods. As such, it's physically impossible to know the full list of recipes (and recipe prototype names) which would need to be renamed. That information only becomes available during the data-updates stage, where those recipes are generated. JSON migration requires exact recipe names, so that's not a viable method. Lua migration does not allow renaming prototypes. I'd like to request a feature which does this, and I have a couple of possible options:
  • 1. Regular expressions inside the JSON file, with the ability to retain part of the match. Let's say for instance I want to rename all "advanced generation" recipes, with a command like this: ["advanced-%1-generation", "alchemistry-advanced-%1-generation"]. That way, I don't need to know every single recipe which was generated, I only need to know the naming convention, which is consistent and under my direct control.
  • 2. A Lua helper function which finds every place a prototype is used, which can be fed a new prototype name. This way, I don't need to worry if a recipe has been set in a machine, in the ghost of a machine, in a blueprint, or in some exotic structure that a mod has defined. This would allow me to walk the list of prototypes, match by regular expression, and change accordingly.
I'm told that something like this was available at some point, but removed for compelling reasons. As such, I understand that this may not be a reasonable request. However, it doesn't hurt to try.
User avatar
Thremtopod
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Wed Nov 06, 2024 8:52 pm
Contact:

Re: Procedural prototype name migrations

Post by Thremtopod »

Post Reply

Return to “Modding interface requests”