Let mods check if a specific mod is loaded
Pathoschild opened this issue ยท 2 comments
To do:
- Check whether Farmhand has an equivalent method, and use the same signature if feasible.
- Add mod registry to get info about other mods.
- Only call
Entry()
after all mods have been loaded.
This will make the log easier to read, and avoid confusion caused by the helper returning different results during theEntry()
phase.
Farmhand has a Farmhand.Registries.ModRegistry
class whose interface doesn't really fit SMAPI's design patterns, so I won't try to match it.
Proposed interface:
/// <summary>Provides metadata about loaded mods.</summary>
public interface IModRegistry
{
/// <summary>Get metadata for all loaded mods.</summary>
IEnumerable<IManifest> GetAll();
/// <summary>Get metadata for a loaded mod.</summary>
/// <param name="uniqueID">The mod's unique ID.</param>
/// <returns>Returns the matching mod's metadata, or <c>null</c> if not found.</returns>
IManifest Get(string uniqueID);
/// <summary>Get whether a mod has been loaded.</summary>
/// <param name="uniqueID">The mod's unique ID.</param>
bool IsLoaded(string uniqueID);
}