mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1022 from erri120/always-ignore
WABBAJACK_ALWAYS_DISABLE
This commit is contained in:
commit
c5e11a2564
@ -107,8 +107,9 @@ There are some special cases where you want to change the default Wabbajack beha
|
||||
| Flag | Description | Notes |
|
||||
|------|-------------|-------|
|
||||
| `WABBAJACK_INCLUDE` | All mod files will be inlined into the `.wabbajack` file | |
|
||||
| `WABBAJACK_NOMATCH_INCLUDE` All mod files will be inlined into the `.wabbajack` file even if Wabbajack did not found a match for them | Useful for custom patches you created |
|
||||
| `WABBAJACK_NOMATCH_INCLUDE` | All mod files will be inlined into the `.wabbajack` file even if Wabbajack did not found a match for them | Useful for custom patches you created |
|
||||
| `WABBAJACK_ALWAYS_ENABLE` | The mod will not be ignored by Wabbajack even if it's disabled | Wabbajack will normally ignore all mods you disabled in MO2 but there are some cases where you might want to give some choice to the end user and want to have the mod included |
|
||||
| `WABBAJACK_ALWAYS_DISABLE` | The mod will always be ignored by Wabbajack | Useful if you don't want some mods included in the Modlist but still want to keep it active in your own setup |
|
||||
|
||||
#### Patches
|
||||
|
||||
|
@ -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||--}";
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
private async Task<byte[]> 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();
|
||||
|
Loading…
Reference in New Issue
Block a user