Mod Dependencies - Ijwu/PhoenixPointModLoader GitHub Wiki

Mod Dependencies

This page is intended to provide mod authors with information as to how PPML resolves mod dependencies.

Dependencies Metadata Field

The Dependencies field in the mod metadata file is of type List<ModMetadata>. What this means is that as long as you provide objects which can deserialize to the ModMetadata class then the mod loader will be happy with them.

Dependency Resolution

Dependencies are weakly linked with other mods. The mod loader scans the dependencies defined in your mod metadata and compares them to all other mods waiting to be loaded. It does a simple string comparison on the provided name as well as an quality check on the provided version for your dependency. Both fields must match exactly to the mod metadata of the mod you are dependent on.

Please note that dependencies are not guaranteed to be loaded before the given mod. The dependency resolution, in its current state, only determines dependency existance. That means that you should wait until all mods are loaded and instantiated before attempting to access other mod classes in order to prevent unintended behavior.

The intent here is to provide an extremely simple, but still useful, dependency resolution mechanism.

Example

If my mod DummyMod is dependent on RootDummyMod then I would define my metadata file as such:

DummyMod.json

{
  "Name": "Dummy Mod",
  "Version": "1.0",
  "Dependencies": [
    {
      "Name": "RootDummyMod",
      "Version": "1.2"
    }
  ]
}

Note: The dependency defined in this case must exactly match the Name and Version in the metadata file for RootDummyMod. If the mod does not define a metadata file then a default one is loaded (more on that in Mod Metadata).

The version string "1.0" does not match "1.0.0" due to how .NET's Version object works. This is intentional and won't change, so please ensure you're matching exactly.