Skip to content

Conversation

FactorioBlueprints
Copy link
Contributor

I just realized that I got rid of the behavior of throwing on missing dependencies. I probably have to add that back.

@Bilka2
Copy link
Collaborator

Bilka2 commented Dec 31, 2022

What exactly is the intention of the code? Circular mod dependencies are not valid, the game will error out if they exist. Does this code try to do the same or does it try to resolve the circular mod dependency somehow?

@FactorioBlueprints
Copy link
Contributor Author

I found at least one example of mods with a circular dependency between them. space-exploration --> space-exploration-postprocess --> space-exploration. With these mods installed, the original code got into an infinite loop. I used a debugger to find this particular example of circular dependencies. I was surprised the game allows it.

@Bilka2
Copy link
Collaborator

Bilka2 commented Dec 31, 2022

These mods do not have a circular dependency, the ~ space-exploration-postprocess dependency in space-exploration does not affect load order, see https://wiki.factorio.com/Tutorial:Mod_structure#dependencies. However, the java data wrapper currently cannot parse this correctly and thinks that load order is affected. The best way to resolve this issue would be to fix the dependency parsing to recognize this dependency type and adjust the mod load order to work with it. For that, see the first section in #37.

@FactorioBlueprints
Copy link
Contributor Author

I see, thanks for the context. I'll close this PR. I may try to improve the parsing code if that would be welcome. However, I also think that my original goal may be out of reach, since mod loading requires so much work. My goal is to export data that shows which entities, recipes, and items come from which mods.

@Bilka2
Copy link
Collaborator

Bilka2 commented Jan 2, 2023

I may try to improve the parsing code if that would be welcome.

That would be appreciated but is in no way expected. If you do, this regex might help: (^(?:(\?|\(\?\)|!|~) *)?(.+?)(?: *([<>=]=?) *([0-9.]+))?$)" - it's what the base game uses for the dependency parsing, group 1 is the symbol (?! etc), group 2 the mod name and group 3 and 4 the comparator and version.

My goal is to export data that shows which entities, recipes, and items come from which mods.

The large part I can see blocking here is the require problems also mentioned in #37. I'd somewhat expect that an export of the prototype history data from the game itself might be easier to implement (from the Factorio dev side). But that would lack a lot of detail, it's the list of mod names you also see in the tooltips in-game. If that would be enough for you, I can inquire whether it could be added to the modding api.

It is generally my goal to fix mod loading in the data wrapper (it will be needed for 1.2) but the timeline on that is quite loose.

FactorioBlueprints added a commit to FactorioBlueprints/Java-Factorio-Data-Wrapper that referenced this pull request Jan 3, 2023
…`~` which indicates dependencies that don't affect mod loading order. Relates to issues demodude4u#37 and demodude4u#42.
FactorioBlueprints added a commit to FactorioBlueprints/Java-Factorio-Data-Wrapper that referenced this pull request Jan 3, 2023
…`~` which indicates dependencies that don't affect mod loading order. Relates to issues demodude4u#37 and demodude4u#42.
Bilka2 added a commit that referenced this pull request Jan 4, 2023
Enhance mod loading to respect dependency declarations starting with `~` which indicates dependencies that don't affect mod loading order. Relates to issues #37 and #42.
@Bilka2
Copy link
Collaborator

Bilka2 commented Jan 4, 2023

[prototype history data is] the list of mod names you also see in the tooltips in-game. If that would be enough for you, I can inquire whether it could be added to the modding api.

I ended up asking internally. The runtime function script.get_prototype_history(type, name) will be part of Factorio 1.1.75 thanks to Rseding.

@FactorioBlueprints
Copy link
Contributor Author

Thank you very much! My goal is to be able to display which mods a blueprint uses. Maybe afterwards, searching by mods.

@FactorioBlueprints FactorioBlueprints deleted the mod-circular-dependencies branch February 13, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants