Change cache reloading and conflicts to actually keep the effective mod and not force full recalculations on every change.

This commit is contained in:
Ottermandias 2022-05-29 19:00:34 +02:00
parent ee87098386
commit 4b036c6c26
29 changed files with 778 additions and 457 deletions

View file

@ -36,7 +36,7 @@ public class ModsController : WebApiController
{
return Penumbra.CollectionManager.Current.ResolvedFiles.ToDictionary(
o => o.Key.ToString(),
o => o.Value.FullName
o => o.Value.Path.FullName
)
?? new Dictionary< string, string >();
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging;
@ -138,7 +139,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
if( collection.HasCache )
{
return collection.ChangedItems;
return collection.ChangedItems.ToDictionary( kvp => kvp.Key, kvp => kvp.Value.Item2 );
}
PluginLog.Warning( $"Collection {collectionName} does not exist or is not loaded." );

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Dalamud.Logging;
using Penumbra.Collections;
using Penumbra.GameData.ByteString;
using Penumbra.Mods;
@ -22,13 +23,13 @@ public enum RedirectResult
public class SimpleRedirectManager
{
internal readonly Dictionary< Utf8GamePath, (FullPath File, string Tag) > Replacements = new();
public readonly HashSet< string > AllowedTags = new();
public readonly HashSet< string > AllowedTags = new();
public void Apply( IDictionary< Utf8GamePath, FullPath > dict )
public void Apply( IDictionary< Utf8GamePath, ModPath > dict )
{
foreach( var (gamePath, (file, _)) in Replacements )
{
dict.TryAdd( gamePath, file );
dict.TryAdd( gamePath, new ModPath(Mod.ForcedFiles, file) );
}
}