mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 00:07:53 +01:00
Current State.
This commit is contained in:
parent
98a89bb2b4
commit
282189ef6d
9 changed files with 115 additions and 56 deletions
|
|
@ -333,6 +333,9 @@ public class CollectionCacheManager : IDisposable, IService
|
|||
cache.ReloadMod(mod, true);
|
||||
|
||||
break;
|
||||
case ModSettingChange.TemporarySetting:
|
||||
cache.ReloadMod(mod!, true);
|
||||
break;
|
||||
case ModSettingChange.MultiInheritance:
|
||||
case ModSettingChange.MultiEnableState:
|
||||
FullRecalculation(collection);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class CollectionEditor(SaveService saveService, CommunicatorService commu
|
|||
|
||||
/// <summary>
|
||||
/// Set a given setting group settingName of mod idx to newValue if it differs from the current value and fix it if necessary.
|
||||
/// /// If the mod is currently inherited, stop the inheritance.
|
||||
/// If the mod is currently inherited, stop the inheritance.
|
||||
/// </summary>
|
||||
public bool SetModSetting(ModCollection collection, Mod mod, int groupIdx, Setting newValue)
|
||||
{
|
||||
|
|
@ -103,6 +103,18 @@ public class CollectionEditor(SaveService saveService, CommunicatorService commu
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool SetTemporarySettings(ModCollection collection, Mod mod, TemporaryModSettings? settings, int key = 0)
|
||||
{
|
||||
key = settings?.Lock ?? key;
|
||||
var old = collection.GetTempSettings(mod.Index);
|
||||
if (old != null && old.Lock != 0 && old.Lock != key)
|
||||
return false;
|
||||
|
||||
collection.Settings.SetTemporary(mod.Index, settings);
|
||||
InvokeChange(collection, ModSettingChange.TemporarySetting, mod, Setting.Indefinite, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Copy the settings of an existing (sourceMod != null) or stored (sourceName) mod to another mod, if they exist. </summary>
|
||||
public bool CopyModSettings(ModCollection collection, Mod? sourceMod, string sourceName, Mod? targetMod, string targetName)
|
||||
{
|
||||
|
|
@ -168,7 +180,7 @@ public class CollectionEditor(SaveService saveService, CommunicatorService commu
|
|||
if (inherit == (settings == null))
|
||||
return false;
|
||||
|
||||
ModSettings? settings1 = inherit ? null : collection.GetInheritedSettings(mod.Index).Settings?.DeepCopy() ?? ModSettings.DefaultSettings(mod);
|
||||
var settings1 = inherit ? null : collection.GetInheritedSettings(mod.Index).Settings?.DeepCopy() ?? ModSettings.DefaultSettings(mod);
|
||||
collection.Settings.Set(mod.Index, settings1);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -179,7 +191,8 @@ public class CollectionEditor(SaveService saveService, CommunicatorService commu
|
|||
{
|
||||
saveService.QueueSave(new ModCollectionSave(modStorage, changedCollection));
|
||||
communicator.ModSettingChanged.Invoke(changedCollection, type, mod, oldValue, groupIdx, false);
|
||||
RecurseInheritors(changedCollection, type, mod, oldValue, groupIdx);
|
||||
if (type is not ModSettingChange.TemporarySetting)
|
||||
RecurseInheritors(changedCollection, type, mod, oldValue, groupIdx);
|
||||
}
|
||||
|
||||
/// <summary> Trigger changes in all inherited collections. </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue