Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Tannery

#1
I'm confused because I've seen two widely different ways to apply patch:

[StaticConstructorOnStartup]
public static class HarmonyInit
{
    static HarmonyInit()
    {
        Harmony harmony = new Harmony("patch.id");
        harmony.PatchAll();
    }
}

and

class ThisMod : Mod
{
    public static Settings settings;
    public ThisMod(ModContentPack content): base(content)
    {
        new Harmony("patch.id").PatchAll();
        settings = GetSettings<Settings>();
    }
    public override string SettingsCategory()
    {
        // ...
    }
    public override void DoSettingsWindowContents(Rect canvas)
    {
        // ...
    }
}

Which one is the right way?

And it's very weird that these two seems cannot synergize through HarmonyPriority, in my test, if a patch is applied in the second way and at the top of modlist, it will ignore priority and always execute first.