Page 1 of 1

regex support in name migration

Posted: Fri Jul 12, 2019 7:17 am
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"]
  ]
}

Re: regex support in name migration

Posted: Sun Sep 08, 2019 7:49 pm
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.

Re: regex support in name migration

Posted: Mon Sep 09, 2019 10:49 pm
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.