đMod Dependency
Mod Dependencies in NML are divided into two categories: Hard dependency and soft dependency.
Hard Dependency
It is also called neccessary dependency. A mod will be loaded only when all of its hard dependencies are loaded.
You can declare your mod hard dependent to some mods, and add reference to compiled DLL of them in project file(.csproj file) to make IDE give correct code analysis.
Soft Dependency
It is also called optional dependency. A mod will be loaded no matter how many its soft dependencies loaded succefully. When a mod with soft dependencies are failed to compile, NML will try to compile it again without any soft dependencies.
To implement it, NML uses macro to control compilation.
When a soft dependent mod exists, NML will add its ID as macro when compiling your mod.
The following is in ModExample(soft dependent on "ä¸çął_ä¸ćĺ"). It implements the function of adding different name generators according to whether "ä¸çął_ä¸ćĺ" exists or not.
In above, "ä¸çął_ä¸ćĺ" is a Chinese mod for Chinese name generator. Because name rule in Chinese is distinct with Romance language family.
Name generator is used in naming custom creatures, custom items and custom races' kingdom, city, culture and so on. It is an important part in game.
For IDE code analysis, you should add reference to dependent mods' DLL. And you need to add mod's ID as predefined constants(All of the line is based on the fact that you want to use full features of IDE)
How to reference to dependent mods
DLL reference
All files you need to reference are in worldbox_Data/StreamingAssets/mods/NML/CompiledMods
. They are named as "ModID.dll"
Project reference
If released dependent mod contains project file(.csproj), you can reference to it directly(You need to search methods in the web)
Last updated