-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
Description
On discord in Dev Forum, "How to construct an environment with only a select few mods enabled and their Masters - Solved" this was discussed.
https://discord.com/channels/759302581448474626/1369726662694142032
This is the way we found to do it
public static void TestTransitiveMasterLocatorToLoadEnviroment()
{
var locator = new TransitiveMasterLocator(
new System.IO.Abstractions.FileSystem(),
new DataDirectoryInjection(@"C:\Steam\steamapps\common\Skyrim Special Edition\Data"),
new GameReleaseInjection(GameRelease.SkyrimSE));
ModKey[] NeededPlugins = new ModKey[]
{
ModKey.FromFileName("Tem's Houses - Sarethi Farm.esp"),
ModKey.FromFileName("Lux - Tem's Houses - Sarethi Farm.esp")
};
var masters = locator.GetAllMasters(NeededPlugins);
Console.WriteLine("Masters Found: ");
foreach (var master in masters)
{
Console.WriteLine(master.FileName);
}
Console.WriteLine();
Console.WriteLine();
HashSet<ModKey> OnlyLoadThese = masters.ToHashSet();
using var env = GameEnvironment.Typical.Builder<ISkyrimMod, ISkyrimModGetter>(GameRelease.SkyrimSE)
.TransformLoadOrderListings(x => x.Where(x => OnlyLoadThese.Contains(x.ModKey)))
.WithTargetDataFolder(@"C:\Steam\steamapps\common\Skyrim Special Edition\Data")
.Build();
Console.WriteLine("Plugins Loaded in Environment: ");
foreach (var plugin in env.LoadOrder.Items)
{
Console.WriteLine($"{plugin.ModKey}");
}
}
But this was a lot of code to accomplish just the basic environment we wanted. Not to mention "TransitiveMasterLocator" was stated to be a primarily back end part of mutagen
