Skip to content

Mod class structure

piotrulos edited this page Apr 7, 2023 · 2 revisions

MSCLoader 1.2+

MSCLoader 1.2+ has new optional mod class structure, that is less likely to crash when references are missing. (It's much simpler on backend)

public class MyMod1 : Mod
{
    public override string ID => "MyMod1"; //Your mod ID (unique)
    public override string Name => "Testing"; //You mod name
    public override string Author => "someone"; //Your Username
    public override string Version => "1.0"; //Version
    public override string Description => "This is test mod..."; //Short description of your mod

    public override void ModSetup()
    {
        SetupFunction(Setup.OnLoad, Mod_OnLoad);
    }

    private void Mod_OnLoad()
    {
        // Called once, when mod is loading after game is fully loaded
    }
}

Info
new override ModSetup() that eliminates use of all old overrides and LoadInMenu bool override
inside ModSetup() you can setup any function(s) you want with custom names.
Example above setups OnLoad with custon name Mod_OnLoad()

See all possible Setup options here

MSCLoader before 1.2 update

Before 1.2 update all fuctions was overrides

public class MyMod1 : Mod
{
    public override string ID => "MyMod1"; //Your mod ID (unique)
    public override string Name => "Testing"; //You mod name
    public override string Author => "someone"; //Your Username
    public override string Version => "1.0"; //Version

    public override bool UseAssetsFolder => false;
    public override bool LoadInMenu => false; //Enables OnMenuLoad() override


    public override void OnLoad()
    {
        // Called once, when mod is loading after game is fully loaded
    }
}
Clone this wiki locally