LuaCsForBarotraumaPlugin.Client
0.0.0-manual
dotnet add package LuaCsForBarotraumaPlugin.Client --version 0.0.0-manual
NuGet\Install-Package LuaCsForBarotraumaPlugin.Client -Version 0.0.0-manual
<PackageReference Include="LuaCsForBarotraumaPlugin.Client" Version="0.0.0-manual" />
<PackageVersion Include="LuaCsForBarotraumaPlugin.Client" Version="0.0.0-manual" />
<PackageReference Include="LuaCsForBarotraumaPlugin.Client" />
paket add LuaCsForBarotraumaPlugin.Client --version 0.0.0-manual
#r "nuget: LuaCsForBarotraumaPlugin.Client, 0.0.0-manual"
#:package LuaCsForBarotraumaPlugin.Client@0.0.0-manual
#addin nuget:?package=LuaCsForBarotraumaPlugin.Client&version=0.0.0-manual&prerelease
#tool nuget:?package=LuaCsForBarotraumaPlugin.Client&version=0.0.0-manual&prerelease
Base Barotrauma Plugin
This repository provides a base template used by most Barotrauma plugins.
Requirements
Before getting started, make sure you have an IDE that supports .NET 8:
- Visual Studio 2022 or later (with C# 10 support)
https://www.visualstudio.com/vs/community/ - JetBrains Rider
https://www.jetbrains.com/rider/
It is also recommended to have Git installed:
- Windows: Download from https://git-scm.com/install/windows
- Linux: Install Git using your distribution’s package manager
Getting the Project
There are two ways to obtain the project:
Option 1: Use the GitHub Template (Recommended)
<img width="400" alt="image" src="https://github.com/user-attachments/assets/fbd5fb22-04cb-471f-9c4d-456736487b35" />
- Create or sign in to a GitHub account.
- Click the Use this template button in the top-right corner of this repository.
- Clone your newly created repository locally:
git clone https://github.com/your_username/your_repo_name
Option 2: Download Directly
<img width="429" alt="image" src="https://github.com/user-attachments/assets/ce9acc22-b516-46aa-af85-7501ed8d942a" />
You can also download the repository as a ZIP file from GitHub and extract it locally, though this option does not include version control.
Setting up the Project
Before opening the project, a few configuration steps are required.
.propsfiles can be edited using any text editor.
Required Configuration
- Edit the file
BuildData.propsand replaceBaseModwith your actual mod name. - Locate the file
UserBuildData.props.exampleand create a copy namedUserBuildData.props.- Edit
UserBuildData.props. - Update the
ModDeployDirvalue so it points to the LocalMods directory of your Barotrauma installation.
- Edit
Opening the Project
You can now open the solution file WindowsSolution.sln (or the appropriate solution for your platform).
If the
.slnfile does not open, ensure that you have a compatible .NET IDE installed.
Once the solution is open, start by editing Plugin.cs, located in the SharedProject in the solution explorer.
You may also rename existing ExampleMod namespaces in the code to whatever fits your mod.
Project Structure
- Server-side code:
ServerProject/ServerSource - Client-side code:
ClientProject/ClientSource - Shared code (used by both client and server):
SharedProject/SharedSource
Within the SharedProject, you can use the CLIENT and SERVER preprocessor symbols to conditionally compile code for the client or the server as needed.
#if SERVER
DebugConsole.NewMessage("Hello from server");
#endif
#if CLIENT
DebugConsole.NewMessage("Hello from client");
#endif
Content
All mod content (XML files, sounds, textures, etc.) should be placed in:
ContentPackageBuilder/Content
All files you put here will automatically be copied to your ModDeployDir, you can trigger this manually by right clicking the ContentPackageBuilder project and pressing build.
If you add new XML content, make sure to update the file list located at:
ContentPackageBuilder/filelist.xml
Testing Your Mod
<img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/56ba8402-7f1e-4f36-a28b-bca48c785c17" />
You can test your mod by pressing the "Launch Barotrauma" button on top, which will automatically launch Barotrauma with the debugger attached and your plugin built.
Building the plugin also automatically generates the mod in the LocalMods folder you configured earlier. You can then enable the mod in-game.
You can also manually right-click WindowsClient and WindowsServer in the solution view, then select Build, which does the same process as the above, without the launching Barotrauma part.
Warning
This method builds the mod in Debug configuration.
To properly publish or update your mod, follow the steps below.
Building for Release
Change the launch option from Launch Barotrauma to Build Release:
<img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/94c8e5f1-2438-4d81-97c7-2c4ca7fc1d39" />
Now simply click Build Release and it should start building your plugin in release mode.
Hot Reload
.NET supports Hot Reload, which lets you apply certain code changes while Barotrauma is running, without rebuilding the mod or restarting the game. This is useful for quickly iterating on gameplay logic.
To use Hot Reload in Visual Studio, launch Barotrauma with your plugin enabled. If your IDE is not attached to the Barotrauma process, you can attach the debugger to the running Barotrauma.exe process using Debug → Attach to Process.
Once attached, make changes to your C# code and apply them using Hot Reload (toolbar button) or Alt + F10. If the change is supported, it will be applied immediately and you can test it in-game.
Hot Reload works best for changes inside existing methods. Structural changes such as adding new classes, changing method signatures, or modifying fields usually require reloading the entire mod.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Basic.Reference.Assemblies.Net80 (>= 1.8.4)
- FluentResults (>= 3.16.0)
- LightInject (>= 6.6.4)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Microsoft.Extensions.Logging.Abstractions (>= 2.1.1)
- Microsoft.Toolkit.Diagnostics (>= 7.1.2)
- OneOf (>= 3.0.271)
- Sigil (>= 5.0.0)
- System.Collections.Immutable (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.0-manual | 41 | 10/11/2026 |