mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Some cleanup.
This commit is contained in:
parent
363b220613
commit
b79fbc7653
2 changed files with 20 additions and 24 deletions
|
|
@ -95,10 +95,10 @@ public class ItemSwapContainer
|
|||
public void LoadMod(Mod? mod, ModSettings? settings)
|
||||
{
|
||||
Clear();
|
||||
if (mod == null)
|
||||
if (mod == null || mod.Index < 0)
|
||||
{
|
||||
_modRedirections = new Dictionary<Utf8GamePath, FullPath>();
|
||||
_modManipulations = new HashSet<MetaManipulation>();
|
||||
_modRedirections = [];
|
||||
_modManipulations = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Penumbra.Mods.Subclasses;
|
|||
public class ModSettings
|
||||
{
|
||||
public static readonly ModSettings Empty = new();
|
||||
public List< uint > Settings { get; private init; } = new();
|
||||
public List< uint > Settings { get; private init; } = [];
|
||||
public int Priority { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ public class ModSettings
|
|||
{
|
||||
Enabled = Enabled,
|
||||
Priority = Priority,
|
||||
Settings = Settings.ToList(),
|
||||
Settings = [.. Settings],
|
||||
};
|
||||
|
||||
// Create default settings for a given mod.
|
||||
|
|
@ -37,30 +37,13 @@ public class ModSettings
|
|||
public static (Dictionary< Utf8GamePath, FullPath >, HashSet< MetaManipulation >) GetResolveData( Mod mod, ModSettings? settings )
|
||||
{
|
||||
if (settings == null)
|
||||
{
|
||||
settings = DefaultSettings(mod);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.AddMissingSettings( mod );
|
||||
}
|
||||
|
||||
var dict = new Dictionary< Utf8GamePath, FullPath >();
|
||||
var set = new HashSet< MetaManipulation >();
|
||||
|
||||
void AddOption( ISubMod option )
|
||||
{
|
||||
foreach( var (path, file) in option.Files.Concat( option.FileSwaps ) )
|
||||
{
|
||||
dict.TryAdd( path, file );
|
||||
}
|
||||
|
||||
foreach( var manip in option.Manipulations )
|
||||
{
|
||||
set.Add( manip );
|
||||
}
|
||||
}
|
||||
|
||||
foreach( var (group, index) in mod.Groups.WithIndex().OrderByDescending( g => g.Value.Priority ) )
|
||||
{
|
||||
if( group.Type is GroupType.Single )
|
||||
|
|
@ -81,6 +64,19 @@ public class ModSettings
|
|||
|
||||
AddOption( mod.Default );
|
||||
return ( dict, set );
|
||||
|
||||
void AddOption( ISubMod option )
|
||||
{
|
||||
foreach( var (path, file) in option.Files.Concat( option.FileSwaps ) )
|
||||
{
|
||||
dict.TryAdd( path, file );
|
||||
}
|
||||
|
||||
foreach( var manip in option.Manipulations )
|
||||
{
|
||||
set.Add( manip );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically react to changes in a mods available options.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue