diff --git a/Wabbajack.Common/Consts.cs b/Wabbajack.Common/Consts.cs index 2e8b593c..e98bec9b 100644 --- a/Wabbajack.Common/Consts.cs +++ b/Wabbajack.Common/Consts.cs @@ -43,6 +43,7 @@ namespace Wabbajack.Common public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE"; public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE"; + public static string WABBAJACK_ALWAYS_DISABLE = "WABBAJACK_ALWAYS_DISABLE"; public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE"; public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}"; diff --git a/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs b/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs index 814e8e4a..b3ab3785 100644 --- a/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs +++ b/Wabbajack.Lib/CompilationSteps/IgnoreDisabledMods.cs @@ -15,13 +15,16 @@ namespace Wabbajack.Lib.CompilationSteps public IgnoreDisabledMods(ACompiler compiler) : base(compiler) { _mo2Compiler = (MO2Compiler) compiler; - var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IsAlwaysEnabled(f.Value)).Select(f => f.Key).Distinct(); + var alwaysEnabled = _mo2Compiler.ModInis.Where(f => HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_ENABLE)).Select(f => f.Key).Distinct(); + var alwaysDisabled = _mo2Compiler.ModInis + .Where(f => HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_DISABLE)).Select(f => f.Key).Distinct(); _allEnabledMods = _mo2Compiler.SelectedProfiles .SelectMany(p => _mo2Compiler.MO2Folder.Combine("profiles", p, "modlist.txt").ReadAllLines()) .Where(line => line.StartsWith("+") || line.EndsWith("_separator")) .Select(line => line.Substring(1).RelativeTo(_mo2Compiler.MO2ModsFolder)) .Concat(alwaysEnabled) + .Except(alwaysDisabled) .ToList(); } @@ -35,18 +38,17 @@ namespace Wabbajack.Lib.CompilationSteps return r; } - public static bool IsAlwaysEnabled(dynamic data) + public static bool HasFlagInNotes(dynamic data, string flag) { if (data == null) return false; if (data.General != null && data.General.notes != null && data.General.notes.Contains( - Consts.WABBAJACK_ALWAYS_ENABLE)) + flag)) return true; - if (data.General != null && data.General.comments != null && - data.General.comments.Contains(Consts.WABBAJACK_ALWAYS_ENABLE)) - return true; - return false; + + return data.General != null && data.General.comments != null && + data.General.comments.Contains(flag); } } } diff --git a/Wabbajack.Lib/CompilationSteps/IncludeThisProfile.cs b/Wabbajack.Lib/CompilationSteps/IncludeThisProfile.cs index 13ea2df3..76752452 100644 --- a/Wabbajack.Lib/CompilationSteps/IncludeThisProfile.cs +++ b/Wabbajack.Lib/CompilationSteps/IncludeThisProfile.cs @@ -36,7 +36,7 @@ namespace Wabbajack.Lib.CompilationSteps private async Task ReadAndCleanModlist(AbsolutePath absolutePath) { - var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IgnoreDisabledMods.IsAlwaysEnabled(f.Value)) + var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IgnoreDisabledMods.HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_ENABLE)) .Select(f => f.Key) .Select(f => f.FileName.ToString()) .Distinct();