Mod upgrader 0.12.35-0.13.9

Search and install new mods. Start Factorio.
For dedicated server handling see Multiplayer Tools

Mod upgrader 0.12.35-0.13.9

Postby Adil » Sun Jun 12, 2016 4:44 pm

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
    5dim_automatization
    5dim_core
    5dim_trains
    AbandonTrain
    AdvancedEquipment
    Advanced_Personal_Defense
    Aircraft
    Avatars
    bad-chest
    Burner_Generator
    Cannon-Turret
    CargoRocket
    Chests
    Combat_Units
    commandcontrol
    ConcreteLogistics
    DesertSun
    DroneHome
    DynamicExpansion
    Encapsulation

    fluid-barrel
    GunTrains
    Laser_Beam_Turret
    LogisticsSigns
    MapCursor
    nightvision
    nixie-tubes
    PackedConcrete
    Placement_Chest
    radar-two
    rctank
    SignPosts
    SmartLoader
    SmartTrains
    TiTaN
    turrets-range
    underground-mining-drills
    UniqueBackerNames
    UnlimitedUpgrades
    Unstable-ground
    WrenchFu
    yi_engines

Incompatible
These are way too different. Mostly because of no longer existing entities or new graphics requirements.
    autofab
    DroneHome
    FARL
    rso-mod
    Hive Wars
    Yuoki_0.2.31

Development
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.
Attachments
updater.zip
0.12.35-0.13.4 (2) Regex tweaks about 'mining-drill' regex. If mod doesn't have those, identical to one below.
(7.42 KiB) Downloaded 121 times
updater.zip
0.12.35-0.13.4
(7.42 KiB) Downloaded 96 times
updater.zip
old version
(3.92 KiB) Downloaded 152 times
Last edited by Adil on Tue Aug 09, 2016 4:43 am, edited 7 times in total.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Adil
Filter Inserter
Filter Inserter
 
Posts: 944
Joined: Fri Aug 15, 2014 8:36 pm

Re: Mod upgrader 0.12.35-0.13.0

Postby Nebbeh » Tue Jun 28, 2016 12:11 am

Just tried this on my entire mod folder but none of the mods that was updated worked ingame.
Nebbeh
Inserter
Inserter
 
Posts: 47
Joined: Sat Apr 16, 2016 1:46 pm

Re: Mod upgrader 0.12.35-0.13.0

Postby nonstickfrypan » Tue Jun 28, 2016 4:34 am

Does not update this (the file in new_mods/ is identical)

Code: Select all
data.raw.player.player.build_distance = 200
data.raw.player.player.reach_distance = 200


nvm... it's not supposed to :)
Last edited by nonstickfrypan on Tue Jun 28, 2016 4:46 am, edited 2 times in total.
nonstickfrypan
Long Handed Inserter
Long Handed Inserter
 
Posts: 53
Joined: Fri Apr 15, 2016 9:02 am

Re: Mod upgrader 0.12.35-0.13.0

Postby nonstickfrypan » Tue Jun 28, 2016 4:37 am

Code: Select all
$ 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'
nonstickfrypan
Long Handed Inserter
Long Handed Inserter
 
Posts: 53
Joined: Fri Apr 15, 2016 9:02 am

Re: Mod upgrader 0.12.35-0.13.0

Postby darkfrei » Tue Jun 28, 2016 9:24 pm

I have this error
Attachments
pyt.PNG
pyt.PNG (5.48 KiB) Viewed 3694 times
User avatar
darkfrei
Smart Inserter
Smart Inserter
 
Posts: 1266
Joined: Thu Nov 20, 2014 11:11 pm

Re: Mod upgrader 0.12.35-0.13.0

Postby Adil » Wed Jun 29, 2016 12:49 am

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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Adil
Filter Inserter
Filter Inserter
 
Posts: 944
Joined: Fri Aug 15, 2014 8:36 pm

Re: Mod upgrader 0.12.35-0.13.4

Postby Adil » Sun Jul 03, 2016 11:37 pm

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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Adil
Filter Inserter
Filter Inserter
 
Posts: 944
Joined: Fri Aug 15, 2014 8:36 pm

Re: Mod upgrader 0.12.35-0.13.4

Postby SamSam » Mon Jul 04, 2016 1:40 am

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!
SamSam
Inserter
Inserter
 
Posts: 32
Joined: Fri Jul 10, 2015 2:02 am

Re: Mod upgrader 0.12.35-0.13.4

Postby Adil » Mon Jul 04, 2016 10:46 am

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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Adil
Filter Inserter
Filter Inserter
 
Posts: 944
Joined: Fri Aug 15, 2014 8:36 pm

Re: Mod upgrader 0.12.35-0.13.4

Postby SamSam » Tue Jul 05, 2016 3:41 pm

Hi, I used this today and it seems to work very well :D. One bug though:
Code: Select all
'(?<!electric-)mining-drill':'electric-mining-drill',

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 :)
SamSam
Inserter
Inserter
 
Posts: 32
Joined: Fri Jul 10, 2015 2:02 am

Re: Mod upgrader 0.12.35-0.13.4

Postby Adil » Tue Jul 05, 2016 5:39 pm

Ouch, I don't remember why it is this way and not just plain replace as other renamings are.
Let's hope:
Code: Select all
'(?<!electric-)(?<!burner-)?mining-drill':'electric-mining-drill'
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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Adil
Filter Inserter
Filter Inserter
 
Posts: 944
Joined: Fri Aug 15, 2014 8:36 pm


Return to Mod-/Installation-Handling

Who is online

Users browsing this forum: No registered users and 2 guests