Skip to content

Adding your fix

Jan Bureš edited this page Mar 5, 2023 · 12 revisions

To add your fix, please make a pull request with your changes in a new feature-* branch.

Fix class format

To make a new fix, put your class into the CommunityFixes.Fix.<YourFixName> namespace. You can either just implement the CommunityFixes.Fix.IFix interface for auto-instantiation to work, or you can extend the provided convenience base class CommunityFixes.Fix.BaseFix, which allows you to utilize KerbalMonoBehavior overrides like OnUpdate(), etc. The base class also provides a Harmony instance _harmony and a Logger instance. You will need to provide an implementation of the Name property for the sake of logging and configuration UI:

public override string Name => "My Fix Name";

When you implement the IFix interface, you will also need to provide an implementation of OnInitialized(); when extending the BaseFix class, a default empty implementation 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()
{
    _harmony.PatchAll(typeof(MyHarmonyPatchClass));
}

Clone this wiki locally