Class ModLoader
The mod loader loads Mod instances from the GetModsFolder().
public static class ModLoader
- Inheritance
-
ModLoader
- Inherited Members
Fields
LoadedMods
A collection of all of the ModInfo instances of the mods that are currently loaded. The string key is the mod's ID, which is also stored in Id.
public static readonly IReadOnlyDictionary<string, ModInfo> LoadedMods
Field Value
Methods
GetExecutingMod(StackFrame[])
Returns the mod that is currently executing code. Note that this method works by traversing the current StackTrace, or a passed StackFrame array, for an assembly that matches a mod assembly. This means that this method is somewhat of a heuristic, and may not work correctly in all cases.
public static ModInfo GetExecutingMod(StackFrame[] frames = null)
Parameters
frames
StackFrame[]The stack frames to use, if using the current StackTrace is not desired.
Returns
- ModInfo
The ModInfo of the currently executing mod, or null if the base game is currently executing.
GetModsFolder()
Returns a DirectoryInfo pointing to the directory that mods should be put into and loaded from
public static DirectoryInfo GetModsFolder()
Returns
- DirectoryInfo
The mod directory
GetOwningMod(string)
A helper method to return the mod that likely owns an object with the given name. The returned mod is based on the pattern that mods use to name their objects, which is usually required to be "ModId.ObjectName".
public static ModInfo GetOwningMod(string objectName)
Parameters
objectName
string