mod_util¶
Source: base/tealdef/gui/menu/mod_util.d.tl
Notes
Checks the dependencies, load order and incompatibilities of a list of active mods and turns the findings into a readable message.
Example
ModUtil¶
record global base/tealdef/gui/menu/mod_util.d.tl:3
global record ModUtil
Notes
Util table of mod_util.tl.
Functions
validateActiveMods(activeMods : {string}, onlyMods? : {string}) : {ModUtil.ToAddModResult}, {ModUtil.MissingModResult}, {ModUtil.ModOrderResult}, {ModUtil.ModIncompatibilityResult} base/tealdef/gui/menu/mod_util.d.tl:40
Notes
Validates every installed mod of an activation list with validateMod and collects the problems.
| Parameter | Type | Description |
|---|---|---|
activeMods |
{string} |
Mod names (folder ids) in activation order. |
onlyMods? |
{string} |
When given, only these mods of activeMods are checked (the order still comes from activeMods). Optional. |
Returns {ModUtil.ToAddModResult}, {ModUtil.MissingModResult}, {ModUtil.ModOrderResult}, {ModUtil.ModIncompatibilityResult}: Four lists: inactive dependencies (ToAddModResult), missing dependencies (MissingModResult), dependencies loaded too late (ModOrderResult) and incompatibilities (ModIncompatibilityResult).
validateMod(modDesc : Mod.ModDesc, order : integer, modName : string, modOrder : {string : integer}, toAdd : {ModUtil.ToAddModResult}, missing : {ModUtil.MissingModResult}, incorrectOrder : {ModUtil.ModOrderResult}, incompatible : {ModUtil.ModIncompatibilityResult}) base/tealdef/gui/menu/mod_util.d.tl:43
Notes
Checks one mod's dependencies and incompatibilities against the active mods and appends the problems to the four result lists.
| Parameter | Type | Description |
|---|---|---|
modDesc |
Mod.ModDesc |
Description of the mod to check, from the mod repository. |
order |
integer |
Position of the mod in the activation order. |
modName |
string |
Name (folder id) of the mod. |
modOrder |
{string : integer} |
Position of each active mod, keyed by mod name. |
toAdd |
{ModUtil.ToAddModResult} |
List that receives dependencies that are installed but not active. |
missing |
{ModUtil.MissingModResult} |
List that receives dependencies that are not installed or have a wrong revision. |
incorrectOrder |
{ModUtil.ModOrderResult} |
List that receives loadBefore dependencies that are active but come later. |
incompatible |
{ModUtil.ModIncompatibilityResult} |
List that receives active mods (in a matching revision) that this mod declares incompatible. |
Details
A dependency on a built-in mod with a wrong version is reported as IncorrectVersion. In the base game the
built-in check runs twice, so such a problem appears twice in missing.
getProblemDescription(toAdd : {ModUtil.ToAddModResult}, missing : {ModUtil.MissingModResult}, incorrectOrder : {ModUtil.ModOrderResult}, incompatible : {ModUtil.ModIncompatibilityResult}) : string, boolean base/tealdef/gui/menu/mod_util.d.tl:48
Notes
Formats the results of validateActiveMods or validateMod as a translated, multi-line message.
Returns string, boolean: The message (empty string when there are no problems) and whether a problem is critical. The second value is true when a required (non-optional) dependency is inactive or missing, or when there is any incompatibility. Wrong load order alone is not critical. When there are no problems the second value is nil.
ModUtil.ToAddModResult¶
record base/tealdef/gui/menu/mod_util.d.tl:4
record ToAddModResult
Notes
A dependency that is installed in a matching version but not active.
Used in the base game: 8 times in 2 files
base/content/gui/gui/menu/mod_selector_page.tl:342
base/content/gui/gui/menu/mod_util.tl:34
Fields
ModUtil.MissingModResult¶
record base/tealdef/gui/menu/mod_util.d.tl:11
record MissingModResult
Notes
A dependency that is not installed or not installed in a matching version.
Used in the base game: 7 times in 2 files
base/content/gui/gui/menu/mod_selector_page.tl:343
base/content/gui/gui/menu/mod_util.tl:34
Fields
| Name | Type | Description |
|---|---|---|
dependent |
string |
Name (folder id) of the mod that declares the dependency. |
reason |
Reason |
Why the dependency is missing. |
name |
string |
Name (folder id) of the required mod. |
loadBefore |
boolean |
True when the dependency must be loaded before the dependent mod. |
optional |
boolean |
True when the dependency is optional. |
displayName |
string |
Display name of the required mod as given in the dependency's mod info; may be empty. |
url |
string |
Download URL of the required mod as given in the dependency's mod info; may be empty. |
ModUtil.MissingModResult.Reason¶
enum base/tealdef/gui/menu/mod_util.d.tl:12
enum Reason
Notes
Why the dependency counts as missing.
| Value | Description |
|---|---|
"NotFound" |
The required mod is not installed. |
"IncorrectVersion" |
The required mod is installed, but its revision is outside the range the dependent mod accepts. |
ModUtil.ModOrderResult¶
record base/tealdef/gui/menu/mod_util.d.tl:25
record ModOrderResult
Notes
An active dependency that must load before the dependent mod but comes after it in the activation order.
Used in the base game: 8 times in 2 files
base/content/gui/gui/menu/mod_selector_page.tl:344
base/content/gui/gui/menu/mod_util.tl:35
Fields
| Name | Type | Description |
|---|---|---|
dependent |
string |
Name (folder id) of the mod that declares the dependency. |
name |
string |
Name (folder id) of the dependency that is loaded too late. |
ModUtil.ModIncompatibilityResult¶
record base/tealdef/gui/menu/mod_util.d.tl:30
record ModIncompatibilityResult
Notes
A pair of active mods where one declares the other incompatible.
Used in the base game: 7 times in 2 files
base/content/gui/gui/menu/mod_selector_page.tl:345
base/content/gui/gui/menu/mod_util.tl:35
Fields
| Name | Type | Description |
|---|---|---|
incompatible |
string |
Name (folder id) of the mod that declares the incompatibility. |
name |
string |
Name (folder id) of the active mod it is incompatible with. |
ModUtil.ModNameAndVersion¶
record base/tealdef/gui/menu/mod_util.d.tl:35
record ModNameAndVersion
Notes
Display name and version of a built-in "mod" ("" = base content, "ug_api_scripting" = scripting API) that mods can reference in dependencies and incompatibilities.
Used in the base game: 1 time in 1 file
base/content/gui/gui/menu/mod_util.tl:4
Fields
| Name | Type | Description |
|---|---|---|
name |
string |
Translated display name. |
version |
integer |
Version compared against the revision range of a dependency. |