regex support in name migration

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

regex support in name migration

Post by Optera »

Problem:
For LTN to indicate carriage positions I am generating virtual signals for every rolling stock in data phase.
The virtual signal names are currently "LTN-"..entity.name which can get in conflict with other LTN signals so i need to rename them to something more unique like "ltn-position-"..entity.name.
However this also means the old signals vanish from all combinators.
Suggestion:
Add regex support to migration so we can migrate auto generated names as well as hard coded ones.
For example to migrate all base rolling stock currently this is required:

Code: Select all

{
  "virtual-signal":
  [
    ["LTN-locomotive", "ltn-position-locomotive"],
    ["LTN-cargo-wagon", "ltn-position-cargo-wagon"],
    ["LTN-fluid-wagon", "ltn-position-fluid-wagon"],
    ["LTN-artillery-wagon", "ltn-position-artillery-wagon"]
  ]
}
with regex it would become this:

Code: Select all

{
  "virtual-signal":
    [["LTN-(.*)", "ltn-position-$1"]
  ]
}

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: regex support in name migration

Post by Mylon »

+1 for this.

I ran into a similar problem where my mod generates items based on robots, including modded robots. Turns out I had a recipe conflict with another mod, so I changed my naming scheme to be more unique. The recipes are easy to resolve, but there's no easy way to resolve this for modded items.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13202
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: regex support in name migration

Post by Rseding91 »

I've thought about this a few times and what it might break if I did it. I don't want to attempt it right now with stable potentially right around the corner but I'm open to looking into it after that.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding interface requests”