Add the option to omit mch offhands from changed items.

This commit is contained in:
Ottermandias 2024-05-21 18:24:21 +02:00
parent bb56faa288
commit e85b84dafe
13 changed files with 192 additions and 117 deletions

View file

@ -6,6 +6,7 @@ using Penumbra.Communication;
using Penumbra.Mods.Editor;
using Penumbra.String.Classes;
using Penumbra.Mods.Manager;
using Penumbra.Util;
namespace Penumbra.Collections.Cache;
@ -252,8 +253,8 @@ public sealed class CollectionCache : IDisposable
return mod.GetData();
var settings = _collection[mod.Index].Settings;
return settings is not { Enabled: true }
? AppliedModData.Empty
return settings is not { Enabled: true }
? AppliedModData.Empty
: mod.GetData(settings);
}
@ -439,9 +440,12 @@ public sealed class CollectionCache : IDisposable
foreach (var (manip, mod) in Meta)
{
ModCacheManager.ComputeChangedItems(identifier, items, manip);
identifier.MetaChangedItems(items, manip);
AddItems(mod);
}
if (_manager.Config.HideMachinistOffhandFromChangedItems)
_changedItems.RemoveMachinistOffhands();
}
catch (Exception e)
{

View file

@ -25,6 +25,7 @@ public class CollectionCacheManager : IDisposable
private readonly ModStorage _modStorage;
private readonly CollectionStorage _storage;
private readonly ActiveCollections _active;
internal readonly Configuration Config;
internal readonly ResolvedFileChanged ResolvedFileChanged;
internal readonly MetaFileManager MetaFileManager;
internal readonly ResourceLoader ResourceLoader;
@ -40,7 +41,8 @@ public class CollectionCacheManager : IDisposable
=> _storage.Where(c => c.HasCache);
public CollectionCacheManager(FrameworkManager framework, CommunicatorService communicator, TempModManager tempMods, ModStorage modStorage,
MetaFileManager metaFileManager, ActiveCollections active, CollectionStorage storage, ResourceLoader resourceLoader)
MetaFileManager metaFileManager, ActiveCollections active, CollectionStorage storage, ResourceLoader resourceLoader,
Configuration config)
{
_framework = framework;
_communicator = communicator;
@ -50,6 +52,7 @@ public class CollectionCacheManager : IDisposable
_active = active;
_storage = storage;
ResourceLoader = resourceLoader;
Config = config;
ResolvedFileChanged = _communicator.ResolvedFileChanged;
if (!_active.Individuals.IsLoaded)
@ -260,7 +263,8 @@ public class CollectionCacheManager : IDisposable
}
/// <summary> Prepare Changes by removing mods from caches with collections or add or reload mods. </summary>
private void OnModOptionChange(ModOptionChangeType type, Mod mod, IModGroup? group, IModOption? option, IModDataContainer? container, int movedToIdx)
private void OnModOptionChange(ModOptionChangeType type, Mod mod, IModGroup? group, IModOption? option, IModDataContainer? container,
int movedToIdx)
{
if (type is ModOptionChangeType.PrepareChange)
{