From 8f33e0af4373f17325123d51cba4f49c5cde8145 Mon Sep 17 00:00:00 2001 From: MapleWheels Date: Fri, 17 Apr 2026 08:54:33 -0400 Subject: [PATCH] - Fixed up the settings menu. - Made SettingEntry throw an error if "Value" attribute is not found in XML. - Fixed saved values for settings sometimes not reloading after disabling and re-enabling a package. --- .../_SettingsMenu/ModsGameplaySettingsMenu.cs | 214 +++++++++++++++--- .../_SettingsMenu/ModsSettingsMenuBase.cs | 4 +- .../_SettingsMenu/SettingsMenuSystem.cs | 6 +- .../Config/SettingsShared.xml | 2 +- .../LuaCsForBarotrauma/Texts/English.xml | 5 + .../[DebugOnlyTest]TestLuaMod/Settings.xml | 16 +- .../SharedSource/LuaCs/Data/SettingEntry.cs | 10 +- .../SharedSource/LuaCs/LuaCsSetup.cs | 6 +- 8 files changed, 212 insertions(+), 51 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsGameplaySettingsMenu.cs b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsGameplaySettingsMenu.cs index bf58e2dd4..9cfa2667e 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsGameplaySettingsMenu.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsGameplaySettingsMenu.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.Xna.Framework; using System.Linq; @@ -20,23 +21,87 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase private string _selectedSearchQuery = string.Empty; private ContentPackage _selectedContentPackage; private string _selectedCategory = string.Empty; + private ImmutableArray _currentlyDisplayedSettings; + private ILoggerService _loggerService; + + private bool _promptOpen = false; + + + // Note: "static" instead of "const" for Hot Reload and to allow changing at runtime. + // ReSharper disable FieldCanBeMadeReadOnly.Local + + // --- UI controls --- + private static float MenuTitleHeight = 0.06f; // (ContentDisplayAreaHeightContainer + MenuTitleHeight) < 1f + private static float ContentDisplayAreaHeightContainer = 0.93f; + private static float ContentDisplayAreaHeightInnerCategories = 0.99f; + private static float ContentDisplayAreaHeightInnerSettings = 0.97f; + private static float ContentLeftRightSplitPosition = 0.3f; + + // Search Bar + private static float SearchBarLayoutHeight = 0.06f; + private static float SearchBarLabelWidth = 0.1f; + private static float SearchBarLabelBoxSpacing = 0.05f; + + private static float SearchBarTextBoxWidth = 1f - SearchBarLabelWidth - SearchBarLabelBoxSpacing; + + // Categories, Packages Display Area + private static float CategoriesDisplayListHeight = 0.945f; + private static float CategoryButtonHeightRelative = 0.122f; + private static float PackageSelectionButtonHeight = 0.07f; + private static Color CategoryButtonHoverSelectColor = new Color(50, 50, 50, 255); + private static Color CategoryButtonTextColor = Color.PeachPuff; + private static Color CategoryButtonTextColorSelected = Color.White; + private static Color CategoryButtonColorPressed = Color.TransparentBlack; + + // Settings Display Area + private static float SettingLabelWidth = 0.6f; + private static float SettingControlWidth = 0.4f; + private static float SettingHeight = 0.05625f/ContentDisplayAreaHeightContainer/ContentDisplayAreaHeightInnerSettings; + private static Color SettingEntryLabelTextColor = Color.PeachPuff; + private static string SettingGUIFrameStyle = ""; + private static Color? SettingGUIFrameColor = null; + + // settings reset + private static Vector2 SettingsResetButtonTopSpacer = new Vector2(0f, 0.02f); + private static Vector2 SettingsResetButtonDimensions = new Vector2(0.3f, 0.05f); + private static string SettingsResetButtonStyle = "GUIButtonSmall"; + private static Color SettingsResetButtonColor = Color.DarkOliveGreen; + private static Color SettingsResetButtonHoverColor = Color.Olive; + private static Color SettingsResetButtonTextColor = Color.PeachPuff; + private static Color SettingsResetButtonTextColorSelected = Color.White; + + private static Vector2 ResetConfirmationPromptDimensions = new Vector2(0.15f, 0.2f); + + + // ReSharper restore FieldCanBeMadeReadOnly.Local + private const string SettingsResetButtonText = "LuaCsForBarotrauma.SettingsMenu.ResetVisibleSettings"; + private const string SettingsResetPromptTitle = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Title"; + private const string SettingsResetPromptContents = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Message"; + private const string SettingsResetPromptYesText = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Yes"; + private const string SettingsResetPromptNoText = "LuaCsForBarotrauma.SettingsMenu.ResetPrompt.No"; + + private event Action OnApplyInstalledModsChanges; public ModsGameplaySettingsMenu(GUIFrame contentFrame, IPackageManagementService packageManagementService, IConfigService configService, + ILoggerService loggerService, SettingsMenu settingsMenuInstance) : base(contentFrame, packageManagementService, configService, settingsMenuInstance) { _settingsInstancesGameplay = configService.GetDisplayableConfigs() .ToImmutableArray(); - + + _loggerService = loggerService; var mainLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 1f), contentFrame.RectTransform, Anchor.Center), false, Anchor.TopLeft); // page title var menuTitleLayoutGroup = new GUILayoutGroup( - new RectTransform(new Vector2(1f, 0.06f), mainLayoutGroup.RectTransform, Anchor.TopLeft), true, Anchor.TopLeft); - GUIUtil.Label(menuTitleLayoutGroup, "Mods Gameplay Settings", GUIStyle.LargeFont, new Vector2(1f, 1f)); + new RectTransform(new Vector2(1f, MenuTitleHeight), mainLayoutGroup.RectTransform, Anchor.TopLeft), true, Anchor.TopLeft); + GUIUtil.Label(menuTitleLayoutGroup, + GetLocalizedString("LuaCsForBarotrauma.SettingsMenu.ModGameplayButton", "Mod Gameplay Settings"), + GUIStyle.LargeFont, new Vector2(1f, 1f)); // page contents var contentAreaLayoutGroup = new GUILayoutGroup( @@ -44,10 +109,10 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase Anchor.TopLeft); var searchBarLayoutGroup = new GUILayoutGroup( - new RectTransform(new Vector2(1f, 0.06f), contentAreaLayoutGroup.RectTransform, Anchor.TopCenter), true, Anchor.CenterLeft); - GUIUtil.Label(searchBarLayoutGroup, "Search: ", GUIStyle.SubHeadingFont, new Vector2(0.1f, 1f)); + new RectTransform(new Vector2(1f, SearchBarLayoutHeight), contentAreaLayoutGroup.RectTransform, Anchor.TopCenter), true, Anchor.CenterLeft); + GUIUtil.Label(searchBarLayoutGroup, "Search: ", GUIStyle.SubHeadingFont, new Vector2(SearchBarLabelWidth, 1f)); var searchBar = new GUITextBox( - new RectTransform(new Vector2(0.85f, 0.1f), searchBarLayoutGroup.RectTransform, Anchor.TopLeft), + new RectTransform(new Vector2(SearchBarTextBoxWidth, 0.1f), searchBarLayoutGroup.RectTransform, Anchor.TopLeft), createClearButton: true) { OnTextChangedDelegate = (btn, txt) => @@ -56,12 +121,13 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase return true; } }; + // main display area - var settingsContentAreaGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.90f), contentAreaLayoutGroup.RectTransform, Anchor.BottomCenter)); + var settingsContentAreaGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, ContentDisplayAreaHeightContainer), contentAreaLayoutGroup.RectTransform, Anchor.BottomCenter)); GUIUtil.Spacer(settingsContentAreaGroup, Vector2.One); (_modCategoryDisplayGroup, _settingsDisplayGroup) = GUIUtil.CreateSidebars(settingsContentAreaGroup, true); - _modCategoryDisplayGroup.RectTransform.RelativeSize = new Vector2(0.3f, 1f); - _settingsDisplayGroup.RectTransform.RelativeSize = new Vector2(0.7f, 1f); + _modCategoryDisplayGroup.RectTransform.RelativeSize = new Vector2(ContentLeftRightSplitPosition, ContentDisplayAreaHeightInnerCategories); + _settingsDisplayGroup.RectTransform.RelativeSize = new Vector2(1f-ContentLeftRightSplitPosition, ContentDisplayAreaHeightInnerSettings); // default category _selectedCategory = "All"; @@ -202,10 +268,11 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase _selectedCategory = string.Empty; GenerateCategoryListDisplay(_modCategoryDisplayGroup, GetTargetPackagesList(), GetDisplayCategoriesList()); GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList()); - }, new Vector2(1f, 0.07f)); - var containerBox = new GUIListBox(new RectTransform(new Vector2(1f, 0.945f), layoutGroup.RectTransform)); - const float entryHeight = 0.122f; - float sizeY = MathF.Max(categories.Length * entryHeight, 1f); + }, new Vector2(1f, PackageSelectionButtonHeight)); + var containerBox = new GUIListBox(new RectTransform(new Vector2(1f, CategoriesDisplayListHeight), layoutGroup.RectTransform)); + + + float sizeY = MathF.Max(categories.Length * CategoryButtonHeightRelative, 1f); var displayedCategoriesFrame = new GUIFrame(new RectTransform(new Vector2(1f, sizeY), containerBox.Content.RectTransform), style: null, color: Color.Black) { CanBeFocused = false @@ -214,17 +281,18 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase foreach (var category in categories) { - var btn = new GUIButton(new RectTransform(new Vector2(1f, entryHeight), displayCategoriesLayout.RectTransform), + var btn = new GUIButton(new RectTransform(new Vector2(1f, CategoryButtonHeightRelative), displayCategoriesLayout.RectTransform), text: category, color: Color.TransparentBlack) { CanBeFocused = true, CanBeSelected = true, - TextColor = Color.PeachPuff, - HoverColor = new Color(50, 50, 50, 255), - HoverTextColor = Color.White, - SelectedColor = new Color(50, 50, 50, 255), - SelectedTextColor = Color.White, - OnPressed = () => + TextColor = CategoryButtonTextColor, + HoverColor = CategoryButtonHoverSelectColor, + HoverTextColor = CategoryButtonTextColorSelected, + PressedColor = CategoryButtonColorPressed, + SelectedColor = CategoryButtonHoverSelectColor, + SelectedTextColor = CategoryButtonHoverSelectColor, + OnClicked = (btn, obj) => { _selectedCategory = category; GenerateSettingsListDisplay(_settingsDisplayGroup, GetDisplaySettingsList()); @@ -237,26 +305,47 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase void GenerateSettingsListDisplay(GUILayoutGroup layoutGroup, ImmutableArray settings) { layoutGroup.ClearChildren(); - const float settingHeight = 0.0625f; + _currentlyDisplayedSettings = settings; - var containerBox = new GUIListBox(new RectTransform(new Vector2(1f, 1f), layoutGroup.RectTransform)); + var containerBox = new GUIListBox(new RectTransform(new Vector2(1f, 1f-SettingsResetButtonDimensions.Y), layoutGroup.RectTransform)); foreach (var setting in settings) { var entry = AddSettingToDisplay( setting, containerBox.Content.RectTransform, - settingHeight: settingHeight, - labelSize: new Vector2(0.6f, 1f), - controlSize: new Vector2(0.4f, 1f)); - - + settingHeight: SettingHeight, + labelSize: new Vector2(SettingLabelWidth, 1f), + controlSize: new Vector2(SettingControlWidth, 1f)); } - } - (GUIFrame entryFrame, GUILayoutGroup entryLayoutGroup) AddSettingToDisplay(ISettingBase setting, - RectTransform parent, float settingHeight, Vector2 labelSize, Vector2 controlSize) + var spacer = new GUIFrame(new RectTransform(SettingsResetButtonTopSpacer, layoutGroup.RectTransform), + style: null, color: Color.TransparentBlack); + + var resetSettingsButton = new GUIButton( + new RectTransform(SettingsResetButtonDimensions, layoutGroup.RectTransform), + GetLocalizedString(SettingsResetButtonText, "Reset Visible Settings"), + style: SettingsResetButtonStyle) + { + CanBeSelected = true, + CanBeFocused = true, + Color = SettingsResetButtonColor, + HoverColor = SettingsResetButtonHoverColor, + SelectedColor = SettingsResetButtonHoverColor, + SelectedTextColor = SettingsResetButtonTextColorSelected, + TextColor = SettingsResetButtonTextColor, + OnClicked = (btn, obj) => + { + DisplayResetConfirmationPrompt(settings); + return true; + } + }; + } + + (GUIFrame entryFrame, GUILayoutGroup entryLayoutGroup) + AddSettingToDisplay(ISettingBase setting, RectTransform parent, float settingHeight, Vector2 labelSize, Vector2 controlSize) { - GUIFrame entryFrame = new GUIFrame(new RectTransform(new Vector2(1f, settingHeight), parent)) + GUIFrame entryFrame = new GUIFrame(new RectTransform(new Vector2(1f, settingHeight), parent), + style: SettingGUIFrameStyle, color: SettingGUIFrameColor) { Color = Color.DarkGray }; @@ -266,9 +355,10 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase new GUIFrame(new RectTransform(new Vector2(0.02f, 1f), entryLayoutGroup.RectTransform), color: Color.TransparentBlack); + // setting label new GUITextBlock(new RectTransform(labelSize - new Vector2(0.05f, 0f), entryLayoutGroup.RectTransform), GetLocalizedString(setting.GetDisplayInfo().DisplayName, setting.GetDisplayInfo().DisplayName), - textColor: Color.PeachPuff, + textColor: SettingEntryLabelTextColor, font: GUIStyle.SmallFont, textAlignment: Alignment.Left) { @@ -281,6 +371,58 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase }); return (entryFrame, entryLayoutGroup); } + + void DisplayResetConfirmationPrompt(ImmutableArray settings) + { + if (_promptOpen) + { + return; + } + + _promptOpen = true; + + var msgBox = new GUIMessageBox(GetLocalizedString(SettingsResetPromptTitle, "Reset Visible Settings"), + GetLocalizedString(SettingsResetPromptContents, + "Are you sure you want to reset the values for currently displayed settings?"), + new LocalizedString[] + { + GetLocalizedString(SettingsResetPromptYesText, "Yes"), + GetLocalizedString(SettingsResetPromptNoText, "No") + }, ResetConfirmationPromptDimensions); + msgBox.Buttons[0].OnClicked = (btn, obj) => + { + ResetValuesForDisplayedSettings(settings); + btn.Visible = false; + _promptOpen = false; + msgBox.Close(); + return true; + }; + msgBox.Buttons[1].OnClicked = (btn, obj) => + { + btn.Visible = false; + _promptOpen = false; + msgBox.Close(); + return true; + }; + } + + void ResetValuesForDisplayedSettings(ImmutableArray settings) + { + if (settings.IsDefaultOrEmpty) + { + return; + } + + NewValuesCache.Clear(); + foreach (var setting in settings) + { + var str = setting.GetDefaultStringValue(); + NewValuesCache[setting] = str; + loggerService.LogDebug($"Resetting value for {setting.InternalName} to '{str}'"); + } + + ApplyInstalledModChanges(); + } } @@ -303,8 +445,12 @@ internal sealed class ModsGameplaySettingsMenu : ModsSettingsMenuBase continue; } - kvp.Key.TrySetSerializedValue(kvp.Value); - ConfigService.SaveConfigValue(kvp.Key); + var success = kvp.Key.TrySetSerializedValue(kvp.Value); + if (success) + { + ConfigService.SaveConfigValue(kvp.Key); + _loggerService.LogDebug($"Applied save value for {kvp.Key.InternalName} of {kvp.Value.ToString()}"); + } } NewValuesCache.Clear(); OnApplyInstalledModsChanges?.Invoke(); diff --git a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsSettingsMenuBase.cs b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsSettingsMenuBase.cs index 9cad5c561..95c626c8f 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsSettingsMenuBase.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/ModsSettingsMenuBase.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Concurrent; +using System.Xml.Linq; using Barotrauma.Extensions; using Barotrauma.LuaCs.Data; using Microsoft.Xna.Framework; +using OneOf; namespace Barotrauma.LuaCs; @@ -12,7 +14,7 @@ internal abstract class ModsSettingsMenuBase : IDisposable protected IPackageManagementService PackageManagementService { get; private set; } protected IConfigService ConfigService { get; private set; } protected SettingsMenu SettingsMenuInstance { get; private set; } - protected readonly ConcurrentDictionary NewValuesCache = new(); + protected readonly ConcurrentDictionary> NewValuesCache = new(); protected ModsSettingsMenuBase(GUIFrame contentFrame, IPackageManagementService packageManagementService, diff --git a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/SettingsMenuSystem.cs b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/SettingsMenuSystem.cs index 9347809c7..2032ec512 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/SettingsMenuSystem.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/_Services/_SettingsMenu/SettingsMenuSystem.cs @@ -18,12 +18,14 @@ public class SettingsMenuSystem : ISettingsMenuSystem private readonly Harmony _harmony; private readonly IPackageManagementService _packageManagementService; private readonly IConfigService _configService; + private readonly ILoggerService _loggerService; private static SettingsMenuSystem SystemInstance; - public SettingsMenuSystem(IPackageManagementService packageManagementService, IConfigService configService) + public SettingsMenuSystem(IPackageManagementService packageManagementService, IConfigService configService, ILoggerService loggerService) { _packageManagementService = packageManagementService; _configService = configService; + _loggerService = loggerService; SystemInstance = this; _harmony = Harmony.CreateAndPatchAll(typeof(SettingsMenuSystem)); } @@ -49,7 +51,7 @@ public class SettingsMenuSystem : ISettingsMenuSystem "SettingsMenuTab.Controls", "LuaCsForBarotrauma.SettingsMenu.ModControlsButton"); */ - _gameplayMenuInstance = new ModsGameplaySettingsMenu(_gameplayContentFrame, _packageManagementService, _configService, __instance); + _gameplayMenuInstance = new ModsGameplaySettingsMenu(_gameplayContentFrame, _packageManagementService, _configService, _loggerService, __instance); //_controlsMenuInstance = new ModsControlsSettingsMenu(_controlsContentFrame, _packageManagementService, _configService, __instance); } diff --git a/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml b/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml index 66d855ef6..99fdf1f3f 100644 --- a/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml +++ b/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml @@ -10,6 +10,6 @@ - + diff --git a/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Texts/English.xml b/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Texts/English.xml index a0f8ccd72..2108b69ad 100644 --- a/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Texts/English.xml +++ b/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Texts/English.xml @@ -2,6 +2,11 @@ Mod Controls Settings Mod Gameplay Settings + Reset Displayed Settings + Reset Visible Settings + Are you sure you want to reset the values for currently displayed settings? + Yes + No Are C# Mods Allowed diff --git a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml index c05583cf2..6d37c0a87 100644 --- a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml +++ b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml @@ -1,14 +1,14 @@  - - - - - - - - + + + + + + + + diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Data/SettingEntry.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Data/SettingEntry.cs index 8d9046f93..83de6d13e 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Data/SettingEntry.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Data/SettingEntry.cs @@ -33,6 +33,11 @@ public partial class SettingEntry : SettingBase, ISettingBase, INetworkSyn ThrowHelper.ThrowArgumentException($"{nameof(ISettingBase)}: The type of {nameof(T)} is not an allowed type."); } ValueChangePredicate = valueChangePredicate; + + if (ConfigInfo.Element.Attribute("Value") is null) + { + ThrowHelper.ThrowArgumentException($"The Setting {InternalName} in package {OwnerPackage.Name} does not have a 'Value' attribute!"); + } try { @@ -147,10 +152,8 @@ public partial class SettingEntry : SettingBase, ISettingBase, INetworkSyn } public override Type GetValueType() => typeof(T); - public override string GetStringValue() => Value?.ToString() ?? string.Empty; - - public override string GetDefaultStringValue() => DefaultValue.ToString(); + public override string GetDefaultStringValue() => DefaultValue?.ToString() ?? string.Empty; public override bool TrySetSerializedValue(OneOf value) { @@ -181,7 +184,6 @@ public partial class SettingEntry : SettingBase, ISettingBase, INetworkSyn return default(T); } }); - return !isFailed && TrySetValue(typeConvertedValue); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs index 195bd5c58..31b64f489 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs @@ -269,7 +269,10 @@ namespace Barotrauma { var state = CurrentRunState; SetRunState(RunState.Unloaded); - SetRunState(state); + CoroutineManager.Invoke(() => + { + SetRunState(state); + },0.25f); }); } @@ -287,6 +290,7 @@ namespace Barotrauma } this.Logger.LogResults(PackageManagementService.SyncLoadedPackagesList(GetLuaCsEnabledPackagesList(packages))); + ConfigService.LoadSavedConfigsValues(); SetRunState(state); // restore }