Difference between revisions of "HPL3/Modding/Mod Dependencies"
(Created page with "{{shortPageTitle}} If your mod has a lot of assets Mod dependencies provide a solution for this issue. File:Mod-dependencies-diagarm.png|thumb|In this example, two mods use...") |
m (Soma mod dependencies are broken as per the discord, updated to reflect issue.) |
||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{shortPageTitle}} | {{shortPageTitle}} | ||
− | + | Mod dependencies provide a solution for sharing mod contents across multiple other mods. A few mods could depend on a parent mod to derive assets and other content from, instead of including it in their own mod. | |
− | + | ||
+ | __TOC__ | ||
+ | |||
+ | <br />{{bug|Mod dependencies are currently broken in Amnesia: Rebirth and Soma. They work for Amnesia: The Bunker}} | ||
==When to Use Mod Dependencies== | ==When to Use Mod Dependencies== | ||
− | The main occasion to use Mod Dependencies is when you want to distribute assets packs which include models, textures, materials, scripts, etc for people to use freely in their own mods. | + | |
+ | *The main occasion to use Mod Dependencies is when you want to distribute assets packs which include models, textures, materials, scripts, etc for people to use freely in their own mods. | ||
+ | *Mod dependencies can help to reduce the mod size you want to distribute, as a big portion of the assets themselves are not actually included in the mod, but come from an external source. | ||
+ | |||
+ | [[File:Mod-dependencies-diagarm.png|thumb|A simple diagram showing the process of a mod dependency. Several mods take resources from one source. Both mods use the castle assets pack.|500x500px|alt=|left]]{{clr}} | ||
+ | {{Note|The level editor will be able to pick on mod dependencies and will load the assets if there are any.}} | ||
==Setting Up a Mod Dependency== | ==Setting Up a Mod Dependency== | ||
− | In order to set | + | In order to turn a regular mod into a mod dependency, the mod's [[HPL3/SOMA/Modding/Creating_a_Mod#Mod_Entry_File|entry file]] needs to have a special attribute called <code>UID</code>. This is used so other mods can reference your mod as a dependency. The convention of naming a UID is the form <code>provider_name.mod_name</code>. For example, if the mod creator is named <code>steve</code> and the mod name is called <code>Castle Assets Pack</code>, the <code>UID</code> for the mod will be <code>steve.castle_assets_pack</code>. |
+ | |||
+ | In order to set a <code>UID</code> manually for a mod: | ||
+ | |||
+ | #Open the mod's entry [[HPL3/SOMA/Modding/Creating_a_Mod#Mod_Entry_File|entry file]]. | ||
+ | #Inside, add an attribute called <code>UID</code> and give it a name:<syntaxhighlight lang="xml"> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <Content Version="1.0" | ||
+ | Type="StandAlone" | ||
+ | Title="Your mod name here" | ||
+ | Author="Your name here" | ||
+ | Description="Mod description here" | ||
+ | |||
+ | UID="my_uid" | ||
+ | |||
+ | LauncherPic="LauncherPic.png" | ||
+ | InitCfg="config/main_init.cfg" | ||
+ | /> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Now you can use the mod as a dependency for other mods. | ||
+ | |||
+ | {{Note|Your dependency can have dependencies of its own as well.}} | ||
==Using a Mod Dependency== | ==Using a Mod Dependency== | ||
− | + | In order to use a mod dependency, the [[HPL3/SOMA/Modding/Creating_a_Mod#Mod_Entry_File|entry file]] of the mod which uses the dependency needs to have a special attribute called <code>Dependencies</code>. It is a list of <code>UIDs</code> separated by commas. | |
+ | |||
+ | In order to set <code>Dependencies</code> manually for a mod: | ||
+ | |||
+ | #Open the entry [[HPL3/SOMA/Modding/Creating_a_Mod#Mod_Entry_File|entry file]] of the mod you want to add a dependency to. | ||
+ | #Inside, add an attribute called <code>Dependencies</code> and list the <code>UID</code>(s): <syntaxhighlight lang="xml"> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <Content Version="1.0" | ||
+ | Type="StandAlone" | ||
+ | Title="Your mod name here" | ||
+ | Author="Your name here" | ||
+ | Description="Mod description here" | ||
+ | |||
+ | Dependencies="my_uid" | ||
+ | |||
+ | LauncherPic="LauncherPic.png" | ||
+ | InitCfg="config/main_init.cfg" | ||
+ | /> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Now your mod loads the mod dependency with the <code>UID</code> of "<code>my_uid</code>". | ||
+ | |||
+ | ==See Also== | ||
+ | |||
+ | *[[HPL3/SOMA/Modding/Creating_a_Mod|Creating a Mod]] | ||
+ | *[[HPL3/Resources_Configuration|Resources Configuration]] | ||
[[Category:Modding]] | [[Category:Modding]] | ||
[[Category:English]] | [[Category:English]] |
Latest revision as of 18:23, 24 January 2024
Mod dependencies provide a solution for sharing mod contents across multiple other mods. A few mods could depend on a parent mod to derive assets and other content from, instead of including it in their own mod.
Contents
Bug: Mod dependencies are currently broken in Amnesia: Rebirth and Soma. They work for Amnesia: The Bunker |
When to Use Mod Dependencies
- The main occasion to use Mod Dependencies is when you want to distribute assets packs which include models, textures, materials, scripts, etc for people to use freely in their own mods.
- Mod dependencies can help to reduce the mod size you want to distribute, as a big portion of the assets themselves are not actually included in the mod, but come from an external source.
Setting Up a Mod Dependency
In order to turn a regular mod into a mod dependency, the mod's entry file needs to have a special attribute called UID
. This is used so other mods can reference your mod as a dependency. The convention of naming a UID is the form provider_name.mod_name
. For example, if the mod creator is named steve
and the mod name is called Castle Assets Pack
, the UID
for the mod will be steve.castle_assets_pack
.
In order to set a UID
manually for a mod:
- Open the mod's entry entry file.
- Inside, add an attribute called
UID
and give it a name:<?xml version="1.0" encoding="UTF-8"?> <Content Version="1.0" Type="StandAlone" Title="Your mod name here" Author="Your name here" Description="Mod description here" UID="my_uid" LauncherPic="LauncherPic.png" InitCfg="config/main_init.cfg" />
Now you can use the mod as a dependency for other mods.
Using a Mod Dependency
In order to use a mod dependency, the entry file of the mod which uses the dependency needs to have a special attribute called Dependencies
. It is a list of UIDs
separated by commas.
In order to set Dependencies
manually for a mod:
- Open the entry entry file of the mod you want to add a dependency to.
- Inside, add an attribute called
Dependencies
and list theUID
(s):<?xml version="1.0" encoding="UTF-8"?> <Content Version="1.0" Type="StandAlone" Title="Your mod name here" Author="Your name here" Description="Mod description here" Dependencies="my_uid" LauncherPic="LauncherPic.png" InitCfg="config/main_init.cfg" />
Now your mod loads the mod dependency with the UID
of "my_uid
".