Skip to content

Latest commit

 

History

History
104 lines (76 loc) · 2.08 KB

File metadata and controls

104 lines (76 loc) · 2.08 KB

Modding Library

Player Usage

Install using the Mod Manager.

Or download and extract to Ori DE\BepInEx\plugins\OriModding.BF.Core.

Developer instructions

Create a mod with the BepInEx 5 Plugin Template.

dotnet new bepinex5plugin -n MyPluginName -T net35 -U 5.3.2

Add the nuget package.

dotnet add package OriModding.BF.Core

Add OriModding.BF.Core to the dependencies.

[BepInPlugin(...)]
[BepInDependency(OriModding.BF.Core.PluginInfo.PLUGIN_GUID)]
public class Plugin : BaseUnityPlugin
{
    void Awake()
    {
        // Initialisation code here
    }
}

Usage: MonoMod.RuntimeDetours

Use the On.<Type>.<Method> event to inject code.

On.GameController.Awake += (orig, self) =>
{
    // Code here
    orig(self);
    // More code here
}

See the MonoMod docs for more details.

Usage: Harmony

Use Harmony attributes to inject code.

[BepInPlugin(...)]
public class Plugin
{
    Harmony harmony;

    void Awake()
    {
        harmony = new Harmony("guid");
        harmony.PatchAll();
    }
}

[HarmonyPatch(typeof(GameController), nameof(GameController.Awake))]
static class GameControllerHarmonyPatch
{
    static void Prefix(GameController __instance)
    {
        // Prefix code here
    }

    static void Postfix(GameController __instance)
    {
        // Postfix code here
    }
}

See the Harmony docs for more details.

OriModding.BF.l10n

Localisation support for providing translations of mods.

To use localised strings, create strings.csv in the root of the mod directory. Example:

,English,Italian
SPIRIT_FLAME,Spirit Flame,Fiamma dello spirito

Then fetch it in code:

using OriModding.BF.l10n;
Strings.Get("SPIRIT_FLAME");

It will fall back to English for any given key if a translation isn't found.