-
Notifications
You must be signed in to change notification settings - Fork 7
Mod_Info Specs
This page is for mod authors.
mod_info.js
contains metadata for a mod, typically cosmetic information,
but also Modnix features like managed config and load order.
It may also be named the same as its archive or folder. See Mod Specs for details.
Dlls may embed this info file with the "Embedded Resource" build action. Embedding mod info in a dll can keep file count low and easy to manage, and prevents most users from modifying (and breaking) it. When embedded, the file may be placed at any path, e.g. at the project's root or in the Properties folder.
mod_info is one big object, js style, optionally wrapped by a pair of brackets. JavaScript comments allowed. Field names may be unquoted and are case-insensitive. Field order does not matter. Unknown fields are ignored. Incompatible values and syntax errors will abort the whole file.
The content should be encoded in UTF-8. Since Modnix 2.0, other Unicode with Byte Order Mark are also allowed.
({ Id : "mod.id.case.insensitive", Version: "1.2", Name : "Name of Mod", Description : "Description of Mod", Author: "Somebody", Contact: "#mods on PP discord", Copyright: "Public Domain", LoadIndex: 50, Url: { "GitHub" : "https://github.com/Sheep-y/Modnix", "NexusMods" : "https://www.nexusmods.com/phoenixpoint/mods/43", "Changelog" : "https://github.com/Sheep-y/Modnix/blob/master/Manager/Resources/Changelog.md", }, })
All fields are optional, but Id
is strongly advised.
It gives your mod a stable identity, easily referred to by Modnix and other mods.
- Type: Dictionary< string, object >[]
- Default: null
- Example: [{ "Eval": 'GetDef( "NJ_Gauss_PDW_WeaponDef" ).SetDamage( 25 )' }]
Actions is a free-form plain-text modding system added in Modnix 3. See [Action] for details.
Setting this field will trigger a error in Modnix 2, because it is not supported. If the mod has DLL parts, they would still be loaded, and the error will be a warning instead.
Compatibility:
- Added in Modnix 3
- Type: Dictionary (Multilingual)
- Default: "Company" if dll, or same as Id
Fill this field to display mod author(s) to mod user.
- Type: AppVer[]
- Default: null
- Example: "bright.new.mod"
- Example: { Id: "Modnix", Min: "2", Max: "2" } // Modnix 2 used PPML 0.3
- Example: [ "PPML", "Non-Modnix" ]
- Example: [ "mod.first", { Id: "PPML", Min: "0.3", Max: "0.3" } ]
A list of mods that this mod would avoid. If any mod is found, this mod will be disabled and not loaded.
The id may be a mod id (case-insensitive), or one of these special ids:
- Modnix
- Checked against Modnix version.
- NonModnix
- Non-Modnix
- Any requirement of these Id will fails with Modnix, regardless of version.
- This allows a mod to "exclude" itself form Modnix.
- PhoenixPoint
- Phoenix Point
- Checked against game version.
- PPML
- PPML+
- PhoenixPointModLoader
- Phoenix Point Mod Loader
- Checked against bundled PPML (Ijwu) version.
Min and Max are optional. If provided, each must be a valid Version, and are inclusive.
Compatibility:
- Added in Modnix 2.4.
- Type: string
- Default: null
- Example: "Sheepy.HelloWorldMod.ModConfig"
This is the Type that Modnix uses to create, reset, and load your mod's configuration. It must be the fullname (with namespace), and it will round trip to and from json.
When a config read is requested, the mod's dll will be scanned for the type. The first match will be used for the whole mod.
If config file does not exist, a new instance of this type will be used as the default value. This also happens when the default value is explicitly requested, such as when a user resets config to default.
If config file does exist, it will be read as text. If requested through api, the text will be deserialised into a new instance of this Type by default.
Compatibility:
- Added in Modnix 2.
- Type: Dictionary (Freestyle)
- Default: null
- Example: "[email protected]"
- Example: { Email: "[email protected]", Nexus: "https://..." }
Fill this field to display contact information to mod user.
Contact are currently displayed as text, but may be linkified in future release.
- Type: Dictionary (Multilingual)
- Default: "Copyright" if dll, or null
Fill this field to display copyright to mod user.
- Type: object
- Default: null
- Example: { Config_Version : 2, Setting_A : "A", Setting_B : "B" }
This is a legacy field for Modnix 1. Modnix 2 will ignore it when ConfigType is set, and Modnix 3 does not recognise it at all.
Filling this field have a noticeable impact on mod_info parse time, especially for big or multi-level configs. Avoid this field except for Modnix 1 compatibility.
In Modnix 2, when this field is used without ConfigType, and a config type is provided through api, the mod loader will compare the field's value with a new instance of the type. If mismatch, a warning will be logged. This is to make sure the field will not be out of sync with the code, a bug that is bound to happen when the same code happens at two places.
Compatibility:
- Removed from Modnix 3. It will not cause error, but will not be loaded either.
- Deprecated in Modnix 2 and will trigger a warning.
- Type: Dictionary (Multilingual)
- Default: "Description" if dll, or same as Id
Fill this field to display mod description to mod user.
- Type: AppVer[]
- Default: null
- Example: "evil.mod"
- Example: { Id: "legacy.mod", Min: "0.75", Max: "0.99" }
- Example: [ "Big", "Bad", "Outdated" ]
- Example: [ "mod.buggy", { Id: "old.mod", Max: "2.99" } ]
A list of mod to be disabled by this mod. All matched mods will be disabled, and your mod will be noted as the cause.
The id may be a mod id (case-insensitive), or one of the special ids. See Avoids for list of special ids.
Min and Max are optional. If provided, each must be a valid Version, and are inclusive.
This can be used to disable old mods that have a different default id, for example, or outdated mods from another author that your mod replaces.
- Type: DllMeta[]
- Default: null
- Example: "ExampleMod.dll"
- Example: [ "ModA.dll", "ModB.dll" ]
- Example: [ { Path: ... }, { Path: ... } ]
- Example: { Path: "mod.dll", "MainMod": [ "namespace.SomeClass", "namespace.AnotherClass" ] }
Specify the dlls and their entry points in form of MethodName : [ FullClassName1, FullClassName1 ].
If entry points are not specified, the dll will be scanned for initialisers.
Method names much match a mod loading phase, case-sensitive. See Mod Specs for a list of phases.
- Type: string
- Values: "temp", "newgame", "dlc", "perm"
- Default: null
Fill this field to declare how the mod affect campaign and save games.
In order of least to most impact:
- temp
- This mean the mod only have temporary effects, and is not expected to impact save games.
- New and existing campaigns may be saved with this mod on, and the save can be loaded when this mod is absent without any side effects.
- Example: No ambush, Weapon damage tuning, Full mutation
- newgame
- This mean the mod only applies on game start, like a new game option.
- After a campaign is started with this mod on, its save can be loaded when this mod is absent without any side effects.
- Example: Random site location / equipment
- dlc
- This mean the mod only applies to new campaign, like a dlc.
- If a campaign is started with this mod on, its saves may fail to load when this mod is absent, or loaded with serious side effects.
- A mod should not claims to be dlc-like if it applies itself to existing campaigns.
- perm
- This mean the mod will taint existing campaign and save games made with it.
- If any campaigns is saved with this mod on, the save may fails to load when this mod is absent, or loaded with serious side effects.
- Example: New equipments, Weapon clip adjustment, Aeroplane capacity expansion.
If the mod's effect varies by config, use the default. If the mod has multiple effects, use the one with most impact.
- Type: string[]
- Default: null
- Example: "Library"
Flags allow a mod to opt-in to special rules.
- Library : If the mod is not Required by any other mods, it will be disabled.
Flags are case insensitive. More flags may be added in the future.
Compatibility:
- Added in Modnix 3.
- Type: string
- Default: File name without extension, or name of containing folder if file is mod_info
- Example: "sheepy.modnix_ppml02_compat"
Id is used to identify your mod.
Other mods can query you or refer to you using this id. If there are multiple mods with same Id, all will be disabled except the latest one.
Id is case-insensitive, and must not be a reserved id:
- Modnix
- NonModnix
- Non-Modnix
- PhoenixPoint
- Phoenix Point
- PPML
- PPML+
- PhoenixPointModLoader
- Phoenix Point Mod Loader
Mods that use any of these Ids will be ignored.
- Type: string[]
- Values: "en", "de", "es", "fr", "it", "pl", "ru", "zh", "*", "-",
- Default: null
- Example: "*"
- Example: [ "en", "de" ]
Fill this field to display supported game language(s) to mod user.
"-" means mod is language-independent (no text). "*" means all official languages are translated.
- Type: signed int32
- Default: 0
- Example: 50
The load order of this mod.
Mods with a lower index are processed and loaded first in a phase, and vice versa.
Suggestion:
- 300 - Very Low Priority
- 200 - Low Priority
- 100 - Below Average
- 0 - Normal
- -100 - Above Average
- -200 - High Priority
- -300 - Very High Priority
Compatibility:
- Added in Modnix 2.
- Type: String[]
- Default: null
- Example: [ "zy/LegendPrologue.dll", "zy/LaserOnFire.js", "mad/AssortedAdjustments.dll" ]
A list of path of mods and/or mod packs. The paths must be relative, and must not go up the file hierarchy. The listed mods will be parsed and loaded independently, unaffected by the other fields of this mod.
This allow the creation of pre-configured, self-containing Mod Packs.
When this field is set, Dlls and Actions must be empty. This means Mod Pack are not real mods.
Thus, Mod Packs cannot be disabled / avoided by other mods, and these fields are ignored: Avoids / Config / DefaultConfig / Disables / Duration / Flags / Lang / LoadIndex / Requires. The limitations are designed so that multiple mod packs can co-exists in a sensible way.
Note that the user can still manually disable the mod packs, preventing its mods from being parsed.
Compatibility:
- Added in Modnix 3
- Type: Dictionary (Multilingual)
- Default: "Title" if dll, or same as Id
Fill this field to set the mod name displayed to end user.
- Type: string[]
- Default: null
- Example: [ "res/System.Buffers.dll", "res/System.Memory.dll" ]
Preloads is a list of dlls that are copied by Modnix Manager to Modnix's preloads folder. These dlls will be loaded as soon as Modnix kicks in, before Unity is loaded, and of course before the game too.
Because the mods have not yet been scanned, the preloads are managed by Modnix Manager, and not by the Mod Loader. Manually installed mods must manually copy these dll(s) to the preloads folder.
It is strongly advised to not use this feature if you can load the dlls you need in the SplashMod phase. The only dlls that must be loaded earlier are those that would override the game's framework dlls. Needless to say, this is High Risk.
The only reason I am implementing this function is that these dll can at least be managed, rather than the alternative which is every mod copy their dlls to the game and leave them there for good. (Yes. Exactly what my C# Scripting Mod did, before this field is implemented.)
Compatibility:
- Added in Modnix 3
- Type: AppVer[]
- Default: null
- Example: "Sheepy.DebugConsole"
- Example: { Id: "Modnix", Min: "0.75", Max: "0.99" }
- Example: [ "PPML", "Non-Modnix" ]
- Example: [ "mod.first", { Id: "mod.second", Max: "2.99" } ]
A list of requirements of this mod. If any requirement is not met, this mod will be disabled and not loaded.
The id may be a mod id (case-insensitive), or one of the special ids. See Avoids for list of special ids.
Min and Max are optional. If provided, each must be a valid Version, and are inclusive.
If there are multiple dependencies on the same mod, for example with different version ranges, any match are considered to match the mod. (An "or" condition).
- Type: Dictionary (Freestyle)
- Default: null
- Example: "https://sheepy.example.com/phoenixpt/hello_world_mod"
- Example: { GitHub: "https://github.com/...", Nexus: "https://nexusmods.com/..." }
Fill this field to display links to mod user. Keys will not be translated.
- Type: Version
- Default: "File Version" if dll, otherwise 0.0
- Example: "1.2.3.4"
- Example: 12
- Example: 12.4
- Example: "1.0.55723"
Version is displayed to users, and may be queried and depended on by other mods.
Version must be one to four positive integers joined by dots. See System.Version for what the number means and how versions are compared.
Dictionary fields maps string keys to string values.
A multilingual dictionary will map language code to content,
such as { en: "English", fr: "Français" }
.
English is the preferred fallback, if exists,
otherwise the first value is the fallback.
At of writing the mod manager is not multilingual, and there is no time table to make use of multiple languages in mod info.
A freestyle dictionary maps any key to any value, and both will be displayed to the user.