redruin1 / factorio-draftsman

A complete, well-tested, and up-to-date module to manipulate Factorio blueprint strings. Compatible with mods.
MIT License
94 stars 17 forks source link

Error when loading Nullius modpack #15

Closed mheidal closed 2 years ago

mheidal commented 2 years ago

Upon running draftsman-update after copy-pasting the contents of my factorio mods folder into factorio-mods, I get the error draftsman.error.IncorrectModVersionError: 0.6.18 . Full traceback, verbose run and mod folder list (as generated by ls) in attached files.

mods-content.txt traceback.txt

redruin1 commented 2 years ago

It seems that the version of angels-smelting in your mod list is version 0.6.8 when the minimum required version in Nullius itself is 0.6.18. Just for the record, can you confirm that Factorio itself loads properly with these mods? And if it does, can you send me a zip file of all the mods packaged together so I can test the exact files on my machine?

redruin1 commented 2 years ago

I've tested the Nullius modpack alone by downloading it from the in-game browser (no angels or anything else), and draftsman-update passes with no issues; It downloaded angels-smelting version 0.6.19. I haven't checked any of the prototypes to make sure they're loaded correctly, but the only problem seems to be the version of this mod in your specific case.

mheidal commented 2 years ago

Thanks for looking at this. Factorio indeed loads correctly with those mods. My mod folder contained several mods with multiple versions. I removed all the outdated versions (so deleting angelssmelting_0.6.8 and leaving angelssmelting_0.6.19) and that fixed the IncorrectModVersionError.

However, when I ran draftsman-update again, I got a new error, which was lupa._lupa.LuaError: [string "<python>"]:183: bad argument #1 to 'for iterator' (table expected, got nil). Again, full mod list and verbose log/traceback included. Please let me know if you want a .zip of the contents of my factorio-mods folder.

mods-content.txt

traceback.txt

mheidal commented 2 years ago

Attached here is the Python script I used to delete all out-of-date mods, you might find it useful since it solved that issue without having to manually delete zip files.

remove_outdated_mods.txt

redruin1 commented 2 years ago

My mod folder contained several mods with multiple versions. I removed all the outdated versions (so deleting angelssmelting_0.6.8 and leaving angelssmelting_0.6.19) and that fixed the IncorrectModVersionError.

I feel a more elegant solution to this problem would be to automatically use the latest version of the mod if multiple versions of the same mod are present, as I think(?) this is how Factorio itself handles it. Because having multiples of the same mod is probably not intended however, it seems sensible to me to issue warnings if mods with the same name are detected during a single load cycle. This is how I've implemented it at the moment.

However, when I ran draftsman-update again, I got a new error, which was lupa._lupa.LuaError: [string ""]:183: bad argument #1 to 'for iterator' (table expected, got nil).

The reason for this was because the entity_status table for defines was nil. Up to this point I've been using a patchwork replacement of Factorio's defines (https://lua-api.factorio.com/latest/defines.html), which worked for vanilla and a lot of modpacks, but clearly much more data is available to the mod at this point so a comprehensive solution is in order.

The problem, however, seems to be that (as far as I can tell) the values of this defines table doesn't seem to be anywhere in Wube's factorio-data... which means these values have to be extracted manually for every Factorio version. Fortunately thanks to this nice script I found this isn't too hard a task and is a tolerable-enough inconvenience for now. This file is called defines.lua and will be located under the compatibility folder.

Here's the updated output with the two problematic mods of your set that I can confirm works (also with some formatting updates). Note the warnings in the "Discovering mods" section: I added another duplicate version to show the different messages.

(factorio-draftsman) D:\SourceCode\repos\Python\factorio-draftsman>draftsman-update --verbose
Reading mods from: D:\SourceCode\repos\Python\factorio-draftsman\draftsman\factorio-mods

Discovering mods...

alien-biomes
angelspetrochem
angelsrefining
angelssmelting
WARNING: Duplicate of mod 'angelssmelting' found (0.6.19)
        Overwriting older version (0.6.11) with newer version (0.6.19)
WARNING: Duplicate of mod 'angelssmelting' found (0.6.8)
        Skipping older version (0.6.8) in favor of newer version (0.6.19)
boblibrary
boblogistics
Bottleneck
nullius

Determining dependency tree...

alien-biomes 0.6.7
archive? True
dependencies:
           base >= 1.1.0
         ? alien-biomes-hr-terrain >= 0.3.1
angelspetrochem 0.9.22
archive? True
dependencies:
           angelsrefining >= 0.12.1
         ? bobplates >= 0.18.8
         ? bobassembly >= 0.18.5
         ? bobrevamp >= 0.18.5
angelsrefining 0.12.2
archive? True
dependencies:
           base >= 1.1.43
         ? bobplates >= 0.18.8
         ? bobrevamp >= 0.18.5
         ? bobmodules >= 0.18.0
         ? boblogistics
         ? rso-mod >= 2.3.3
         ? Yuoki >= 0.4.0
         ? UraniumPower >= 0.6.4
         ? Nucular >= 0.2.0
angelssmelting 0.6.19
archive? True
dependencies:
           angelsrefining >= 0.12.1
           angelspetrochem >= 0.9.20
         ? bobplates >= 0.18.8
boblibrary 1.1.5
archive? True
dependencies:
           base >= 1.1.0
boblogistics 1.1.5
archive? True
dependencies:
           base >= 1.1.0
           boblibrary >= 1.1.0
         ? bobplates >= 1.1.0
         ? bobinserters >= 1.1.0
Bottleneck 0.11.7
archive? True
dependencies:
           base >= 1.0.0
nullius 1.4.8
archive? True
dependencies:
           base >= 1.1.39
         ? Transport_Drones >= 1.0.6
           alien-biomes >= 0.6.5
           angelssmelting >= 0.6.18
           boblogistics >= 1.1.3
         ? RecipeBook >= 2.7.1
         ? underground-pipe-pack >= 1.1.2
         ? RenaiTransportation >= 1.0.0
         ? boblibrary >= 1.1.4
         ? IRobot >= 1.1.0
         ! aai-industry

Load order:
['base', 'Bottleneck', 'alien-biomes', 'boblibrary', 'boblogistics', 'angelsrefining', 'angelspetrochem', 'angelssmelting', 'nullius']

SETTINGS.LUA:
        mod: Bottleneck
        mod: alien-biomes
        mod: boblibrary
        mod: boblogistics
        mod: angelsrefining
        mod: angelspetrochem
        mod: nullius
SETTINGS-UPDATES.LUA:
        mod: angelsrefining
        mod: angelspetrochem
        mod: angelssmelting
        mod: nullius
SETTINGS-FINAL-FIXES.LUA:
DATA.LUA:
        mod: base
        mod: Bottleneck
        mod: alien-biomes
        mod: boblibrary
        mod: boblogistics
        mod: angelsrefining
        mod: angelspetrochem
        mod: angelssmelting
        mod: nullius
DATA-UPDATES.LUA:
        mod: base
        mod: alien-biomes
        mod: boblogistics
        mod: angelsrefining
        mod: angelspetrochem
        mod: angelssmelting
        mod: nullius
DATA-FINAL-FIXES.LUA:
        mod: alien-biomes
        mod: boblibrary
        mod: angelsrefining
        mod: angelspetrochem
        mod: angelssmelting
        mod: nullius

Extracted mods...
Extracted entities...
Extracted instruments...
Extracted items...
Extracted modules...
Extracted recipes...
Extracted signals...
Extracted tiles...

Update finished.
hella slick; nothing broke!

Hopefully when I push this it will just werk. All of these changes will be in version 0.9.5.

redruin1 commented 2 years ago

Alright, try updating the package and see how that goes.

mheidal commented 2 years ago

After upgrading the package to 0.9.5, I was able to run draftsman-update successfully. Thanks for your help!