Skip to content

Adding your fix

Jan Bureš edited this page Jan 24, 2024 · 12 revisions

To add your fix, please make a pull request to the dev branch with your changes and an updated README.md with your fix description and attribution.

Fix class format

To make a new fix, put your class into the CommunityFixes.Fix.<YourFixName> namespace. You have to extend the provided convenience base class CommunityFixes.Fix.BaseFix, which allows you to utilize MonoBehavior life cycle methods like Update(), etc. The base class also provides a Harmony instance HarmonyInstance, a Logger instance and the BindConfigValue method to easily add configuration. Your fix class needs to have the CommunityFixes.Fix.FixAttribute attribute which contains a user-readable name/short description of the fix:

[Fix("My first fix")]
public class MyFirstFix: BaseFix
{ ... }

When extending the BaseFix class, a default empty implementation of the OnInitialized() method is provided which you can override.

If your fix utilizes Harmony patches, you can register them in your OnInitialized() override method like this:

public override void OnInitialized()
{
    HarmonyInstance.PatchAll(typeof(MyHarmonyPatchClass));
}

An on/off toggle setting is automatically defined for your fix in Main Menu->Settings->Mods->Community Fixes.

Clone this wiki locally