-
-
Notifications
You must be signed in to change notification settings - Fork 19
Plugin Development
To make a plugin, simply create a class that inherits from IPlugin. See the client only template here or the server/client template here. Remember, Space Engineers is a .Net Framework game, so you must use .Net Framework 4.8 and c# language version 7.3 in your projects.
Plugins can also use session components, just like mods can. An IPlugin class is still required. Entity game logic components are not supported.
To use the plugin settings button in the plugin list, create a public void OpenConfigDialog() method in your IPlugin class.
Dependencies that are packaged with Plugin Loader:
- Harmony 2.2.2
- Newtonsoft.json 13.0.3
To include any other dependencies, you must include them in the Plugin Hub xml file as specified in the example. Don't add any other dependencies unless they are absolutely necessary for your plugin to work.
To include any assets in your project, add the path to your assets folder as specified in the Plugin Hub example file. Plugin Loader will call the public void LoadAssets(string) method in your IPlugin class with the full path to the assets folder before the Init function.
- Avoid adding features that might give an excessive advantage to players in multiplayer
- Use .Net Framework 4.8
- Use C# version 7.3 maximum (LangVersion in .csproj file)
- Do not use implicit usings (ImplicitUsings in .csproj file)
- 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
HarmonyReversePatchattribute - Avoid using
Harmony.PatchAll(), useHarmony.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
- No modifying the functionality or behavior of Plugin Loader itself
- No executable files in the assets folder
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.
- Create a GitHub repository for your code
- Fork the Plugin Hub
- Add your xml file to the Plugins folder in the repository (example)
- Submit a pull request and wait for it to be approved
- Linux compatibility - Wine/Proton, Steam Deck