Developing Your Mod - Monster-Train-2-Modding-Group/Trainworks-Reloaded GitHub Wiki

Congrats you have just developed your first mod. Let's talk about the structure of mods for Monster Train 2.

Mod structure

Mods contain:

  • Code β€” .cs (CSharp) files which are built into a .dll

  • Game Data β€” .json files which get loaded by the framework. The .json may reference things defined in your Code.

  • Assets β€” images and textures referenced by the .json files.

Building

  • If you edit any .cs file β†’ recompile the mod with:

    dotnet build -c Release --output ./dist or simply Building if you are using Visual Studio.

  • If you add/remove .json files β†’ update the AddMergedJsonFile function call in Plugin.cs, then rebuild.

  • If you edit .json or images only β†’ rebuild not required just copy the modified files to the BepinEx/plugins folder for testing.

Committing Changes

In Codespaces:
  1. Press Ctrl+Shift+G to open Source Control.

  2. Commit and push your changes.

  3. Make sure your mod builds successfully before committing.

When building locally with Visual Studio:
  1. Use a Git client, like TortoiseGit or Git Bash

  2. Make sure your mod builds successfully before pushing your code to GitHub.

Easier Local Testing (Codespaces)

In Codespaces, zip and download your build:

zip dist.zip -r dist

Download dist.zip from your codespace.

Extract dist.zip into your local BepInEx/plugins folder.

🚫 Don’t commit the zip file to GitHub.


Continue onto Modding Tools

⚠️ **GitHub.com Fallback** ⚠️