Skip to content

ModRegistry

Kanisuko edited this page May 23, 2026 · 8 revisions

ModRegistry

Namespace:​ ScavLib.mods

A simple registry for mod metadata. Register your mod so other mods and ScavLib tooling can discover it at runtime.


Registering Your Mod

Call ModRegistry.Register() in your plugin's Awake():

using ScavLib.mods;

ModRegistry.Register(new ModInfo(
    name:        "MyMod",
    version:     "1.0.0",
    description: "Does cool things.",
    author:      "YourName"
));

ScavLib registers itself automatically on load:

ScavLib (0.2.0) by Kanisuko / QinShenYu: Base API library for Scav Prototype mods.

ModInfo Fields

Field Type Description
Name string Display name of the mod.
Version string Version string, e.g. "1.0.0".
Description string Short description of what the mod does.
Author string Author name(s). Defaults to "Unknown" if omitted.

Querying the Registry

Method Returns Description
GetAll() IReadOnlyList<ModInfo> All registered mods.
TryFind(string name, out ModInfo info) bool Find a mod by name (case-insensitive). Returns the first match.
IsRegistered(string name) bool Quick check whether a mod with the given name is registered.
// Check if a dependency is loaded before using its features
if (!ModRegistry.IsRegistered("SomeDependencyMod"))
{
    Logger.LogWarning("SomeDependencyMod is not installed. Some features disabled.");
    return;
}

// Enumerate all mods
foreach (var mod in ModRegistry.GetAll())
    GameUtil.Log(mod.ToString());
// Output: "MyMod (1.0.0) by YourName: Does cool things."

Duplicate Registration

If a mod with the same name is registered more than once, a warning is logged but both entries are kept. TryFind() returns the first match. Avoid registering the same mod name twice.

Clone this wiki locally