mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 20:54:16 +01:00
Add some logging, fix som bugs
This commit is contained in:
parent
85fb98b557
commit
9037166d92
12 changed files with 58 additions and 41 deletions
|
|
@ -44,7 +44,8 @@ public class TempModManager : IDisposable
|
|||
public RedirectResult Register(string tag, ModCollection? collection, Dictionary<Utf8GamePath, FullPath> dict,
|
||||
HashSet<MetaManipulation> manips, int priority)
|
||||
{
|
||||
var mod = GetOrCreateMod(tag, collection, priority, out var created);
|
||||
var mod = GetOrCreateMod(tag, collection, priority, out var created);
|
||||
Penumbra.Log.Verbose($"{(created ? "Created" : "Changed")} temporary Mod {mod.Name}.");
|
||||
mod.SetAll(dict, manips);
|
||||
ApplyModChange(mod, collection, created, false);
|
||||
return RedirectResult.Success;
|
||||
|
|
@ -52,10 +53,11 @@ public class TempModManager : IDisposable
|
|||
|
||||
public RedirectResult Unregister(string tag, ModCollection? collection, int? priority)
|
||||
{
|
||||
Penumbra.Log.Verbose($"Removing temporary mod with tag {tag}...");
|
||||
var list = collection == null ? _modsForAllCollections : _mods.TryGetValue(collection, out var l) ? l : null;
|
||||
if (list == null)
|
||||
return RedirectResult.NotRegistered;
|
||||
|
||||
|
||||
var removed = list.RemoveAll(m =>
|
||||
{
|
||||
if (m.Name != tag || priority != null && m.Priority != priority.Value)
|
||||
|
|
@ -80,12 +82,19 @@ public class TempModManager : IDisposable
|
|||
if (collection != null)
|
||||
{
|
||||
if (removed)
|
||||
{
|
||||
Penumbra.Log.Verbose($"Removing temporary Mod {mod.Name} from {collection.AnonymizedName}.");
|
||||
collection.Remove(mod);
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Adding {(created ? "new " : string.Empty)}temporary Mod {mod.Name} to {collection.AnonymizedName}.");
|
||||
collection.Apply(mod, created);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Triggering global mod change for {(created ? "new " : string.Empty)}temporary Mod {mod.Name}.");
|
||||
_communicator.TemporaryGlobalModChange.Invoke(mod, created, removed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue