This is a python script which uses regular expressions to perform changes mentioned here
It is written to plug the most outstanding breakages of compatibility, however complicated data flow analysis is outside of its scope.
Usage:
1. Put it near 'mods' folder (in factorio folder or elsewhere)
2. Launch the script with python. (I've tested it on python3)
3. A folder 'new_mods' will be created which will contain hopefully workable versions of the mods.
Tried on
The following mods loaded in 0.13 after application of scripts
Well, I've spent quite a while on this script, to a certain extent it is functional. It was educational. However, I doubt the current branch has a future.
I've chosen to implement this in python because it comes with easy to install interpreter for each platform, as well as tools for folder scanning (unlike lua).
However, this brought burden to development and functionality: python regexp library while fancy lacks facilities to handle the code of complicated structure, you have to fall back to consecutive scanning of the text every so often. Also, it is problematic to detect expressions that come together during runtime (procedural generation of the data).
So this script will not be developed further.
It is unknown I'll be doing this again, so I'll put my thoughts about the better program for the task here:
Moving away from lua was a mistake.
Most of the problems in updating arose from prototype format alterations unmentioned earlier.
To handle those, instead of only parsing text it'd be more productive to actually run the files in mod, compare the data they produce with the vanilla one and to create additional files with commands that would handle the discrepancies.
The code would still also need to be parsed for other changes, but lua regex actually comes with search for balanced brackets, which is instrumental to code fixing.
On the flip side, standard distribution is bare bones and you'll have to either write platform-dependent shell-calls and their parsing, or to pack a custom distribution with bonus libraries, which makes it difficult to check the code for what it is doing.
Re: Mod upgrader 0.12.35-0.13.0
Posted: Tue Jun 28, 2016 12:11 am
by Nebbeh
Just tried this on my entire mod folder but none of the mods that was updated worked ingame.
Re: Mod upgrader 0.12.35-0.13.0
Posted: Tue Jun 28, 2016 4:34 am
by nonstickfrypan
Does not update this (the file in new_mods/ is identical)
$ python3 updater.py
updating
_____Orbital-Ion-Cannon-master_____
Traceback (most recent call last):
File "updater.py", line 341, in <module>
main()
File "updater.py", line 33, in main
if not match.group(2) or not match.group(3):
AttributeError: 'NoneType' object has no attribute 'group'
Re: Mod upgrader 0.12.35-0.13.0
Posted: Tue Jun 28, 2016 9:24 pm
by darkfrei
I have this error
Re: Mod upgrader 0.12.35-0.13.0
Posted: Wed Jun 29, 2016 12:49 am
by Adil
darkfrei wrote:I have this error
Apparently, because updater.py was supposed to be located nearby the `mods` folder, not in it.
However, it's unlikely to work anyway, there's been a bunch of changes unmentioned previously,
For examplte these include the increased rigorousness of json parsing and there quite a bunch of mods I've found that have that one defined pretty lazily.
I believe most modders will, fix their mods themselves before I'll have time to deal with this. I'm sorry.
Re: Mod upgrader 0.12.35-0.13.4
Posted: Sun Jul 03, 2016 11:37 pm
by Adil
I've finished the script,
notable feature of the new release is that it became less forgiving about deviations from standard. Thus quite a part of the upgrade was detecting and fixing of those errors in code.
Still, some of the mods are way to gone to be covered by this.
The list in the op shows the mods I've been able to start in 0.13, some of them (Advanced_personal_defense) I've even seen working, but I can't guarantee that scripted part of the mod will work without a hitch.
Re: Mod upgrader 0.12.35-0.13.4
Posted: Mon Jul 04, 2016 1:40 am
by SamSam
Hive Wars? I'm surprised to see that as incompatible, given that it was fairly simple for a friend and I to fix as the issues that didn't allow it to load were just basic ones, I believe that we had to change game.get_surface, we had to change some item names that were changed (eg piercing-rounds-magazine) and add 2 properties to a character prototype (loot_pickup_distance and item_pickup_distance). However I believe that that final fix was not in control.lua, that could be the problem? Also we are still having desyncs when placing worm items if anyone has ideas. I can upload a version that works if you want to compare it when I get home in a few hours.
Edit: Still seems like a very helpful tool, hope I can get some good use out of it so thanks for making it!
Re: Mod upgrader 0.12.35-0.13.4
Posted: Mon Jul 04, 2016 10:46 am
by Adil
There's been more prototype format alterations than mentioned in changelogs.
belts, pumps, and many more obtained new fields that needed to be added. Yesterday I was too tired to figure out what `connector_frame_sprites` is and where could I get those.
Also, the version of Hivewars I had (maybe not the most recent one) had a plain copypaste of vanilla in its data.lua. Which referenced other, now different files in vanilla (stone-furnace-fire.png for example) there's no graceful solution this problem that doesn't involve creating reading comprehension program.
I've added dirty workaround for such problem encountered in the Hivewars, but that will not solve similar problems with other mods.
That being said I've updated the download in the op.
Re: Mod upgrader 0.12.35-0.13.4
Posted: Tue Jul 05, 2016 3:41 pm
by SamSam
Hi, I used this today and it seems to work very well . One bug though:
in the 'medium' section causes burner-mining-drill to become burner-electric-mining-drill which makes the mod not work but of course it is easy to fix.
Thanks
Re: Mod upgrader 0.12.35-0.13.4
Posted: Tue Jul 05, 2016 5:39 pm
by Adil
Ouch, I don't remember why it is this way and not just plain replace as other renamings are. Let's hope: [code]'(?<!electric-)(?<!burner-)?mining-drill':'electric-mining-drill'[/code] solves this.
edit 7.08.2016: It solves nothing, and I don't really remember why this replacement appeared in the first place, still, a moderated version of it is now in the new version of the script.