Skip to content
This repository was archived by the owner on Jun 29, 2025. It is now read-only.

Plugin Development

avaness edited this page May 16, 2023 · 13 revisions

To make a plugin, simply create a class that inherits from IPlugin. See the client only template here or the server/client template here.

To use the plugin settings button in the plugin list, create a public void OpenConfigDialog() method in your IPlugin class.

Planned Features

Some features do not work in Plugin Loader yet, but are planned.

  • Plugin Loader does not support external references other than Harmony yet. In the future, developers will be able to specify NuGet packages in their Plugin Hub files.
  • Plugin Loader does not support files, only C# code is used. In the future, developers will be able to use a LoadAssets method in the IPlugin class to load files from the disk.

Rules

  • Avoid adding features that might give an excessive advantage to players in multiplayer
  • Use C# version 7.3 maximum
  • No modifying the mod API whitelist
  • No modifying the availability or visibility of DLC in game
  • Do not use the Harmony reverse patch feature or the HarmonyReversePatch attribute
  • Avoid using Harmony.PatchAll(), use Harmony.PatchAll(Assembly.GetExecutingAssembly()) instead
  • Plugin Loader doesn't know how to read project files, so make sure there aren't any unnecessary cs files in your repository
  • Don't use assembly name or location
  • No built in auto updating functionality

Testing

The preferred way to develop plugins is to use the development folder feature. In this mode Plugin Loader will compile your plugin at startup so you don't need to worry about dll files. Once the plugin is loaded you can attach your IDE to the game and you should be able to use breakpoints to debug your code.

To add your project to the list, simply click "Add development folder" at the bottom of the plugin list. You will need to provide the root folder of your project and your plugin hub xml file. It is highly recommended that you install git so that Plugin Loader can use it to filter out files that should be ignored.

Once you have your development plugin in the list, you can delete it, load a new plugin hub file, or switch between debug and release builds in the plugin details menu.

You can use Ctrl + Alt + F5 in the plugin list or in game to restart the game.

Publishing

  1. Create a GitHub repository for your code
  2. Fork the Plugin Hub
  3. Add your xml file to the Plugins folder in the repository
  4. Submit a pull request and wait for it to be approved

Clone this wiki locally