From 3a5fbfde1efd094ef1c040b84c0fdb4f56e688af Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:12:20 -0300 Subject: [PATCH] Fix cs enabled for session state not being preserved between reloads --- .../BarotraumaClient/ClientSource/LuaCs/LuaCsSetup.cs | 2 +- .../BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/LuaCsSetup.cs b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/LuaCsSetup.cs index f1fdab03a..1c67daf45 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/LuaCsSetup.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/LuaCsSetup.cs @@ -129,7 +129,7 @@ namespace Barotrauma new GUITextBlock(new RectTransform(new Vector2(1f, 1f), packageFrame.RectTransform), package.Name); } - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0f), msgBoxLayout.RectTransform), "CSharp mods are not sandboxed, meaning that they have unrestrictive access to your computer, please make sure you trust these mods before you continue. If you are not hosting a server, selecting cancel will only run Lua-mods.", wrap: true) + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0f), msgBoxLayout.RectTransform), "C# mods are not sandboxed, meaning that they have unrestrictive access to your computer, please make sure you trust these mods before you continue. If you are not hosting a server, selecting cancel will only run Lua mods.", wrap: true) { Wrap = true }; diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs index 8c6502776..7eb9fd6a5 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs @@ -230,8 +230,14 @@ namespace Barotrauma CoroutineManager.Invoke(() => { +#if CLIENT + bool prevCsEnabled = _isCsEnabledForSession; +#endif var state = CurrentRunState; SetRunState(RunState.Unloaded); +#if CLIENT + _isCsEnabledForSession = prevCsEnabled; +#endif SetRunState(state); }); }