diff --git a/src/Bannerlord.ModuleManager/ModuleUtilities.cs b/src/Bannerlord.ModuleManager/ModuleUtilities.cs index f02e7a8..2cb5e16 100644 --- a/src/Bannerlord.ModuleManager/ModuleUtilities.cs +++ b/src/Bannerlord.ModuleManager/ModuleUtilities.cs @@ -636,9 +636,8 @@ public static void EnableModule(IReadOnlyCollection modules, } private static void EnableModuleInternal(IReadOnlyCollection modules, ModuleInfoExtended targetModule, HashSet visitedModules, Func getSelected, Action setSelected, Func getDisabled, Action setDisabled) { - if (visitedModules.Contains(targetModule)) return; - visitedModules.Add(targetModule); - + if (!visitedModules.Add(targetModule)) return; + setSelected(targetModule, true); var opt = new ModuleSorterOptions { SkipOptionals = true, SkipExternalDependencies = true }; @@ -709,9 +708,8 @@ public static void DisableModule(IReadOnlyCollection modules } private static void DisableModuleInternal(IReadOnlyCollection modules, ModuleInfoExtended targetModule, HashSet visitedModules, Func getSelected, Action setSelected, Func getDisabled, Action setDisabled) { - if (visitedModules.Contains(targetModule)) return; - visitedModules.Add(targetModule); - + if (!visitedModules.Add(targetModule)) return; + setSelected(targetModule, false); var opt = new ModuleSorterOptions { SkipOptionals = true, SkipExternalDependencies = true };