mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Allow non-locking, negative identifier-locks
This commit is contained in:
parent
5f9cbe9ab1
commit
cff482a2ed
5 changed files with 7 additions and 7 deletions
|
|
@ -163,7 +163,7 @@ public class TemporaryApi(
|
|||
return ApiHelpers.Return(PenumbraApiEc.ModMissing, args);
|
||||
|
||||
if (!collectionManager.Editor.CanSetTemporarySettings(collection, mod, key))
|
||||
if (collection.GetTempSettings(mod.Index) is { } oldSettings && oldSettings.Lock != 0 && oldSettings.Lock != key)
|
||||
if (collection.GetTempSettings(mod.Index) is { Lock: > 0 } oldSettings && oldSettings.Lock != key)
|
||||
return ApiHelpers.Return(PenumbraApiEc.TemporarySettingDisallowed, args);
|
||||
|
||||
var newSettings = new TemporaryModSettings()
|
||||
|
|
@ -254,7 +254,7 @@ public class TemporaryApi(
|
|||
var numRemoved = 0;
|
||||
for (var i = 0; i < collection.Settings.Count; ++i)
|
||||
{
|
||||
if (collection.GetTempSettings(i) is not null
|
||||
if (collection.GetTempSettings(i) is {} tempSettings && tempSettings.Lock == key
|
||||
&& collectionManager.Editor.SetTemporarySettings(collection, modManager[i], null, key))
|
||||
++numRemoved;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class CollectionEditor(SaveService saveService, CommunicatorService commu
|
|||
public bool CanSetTemporarySettings(ModCollection collection, Mod mod, int key)
|
||||
{
|
||||
var old = collection.GetTempSettings(mod.Index);
|
||||
return old == null || old.Lock == 0 || old.Lock == key;
|
||||
return old is not { Lock: > 0 } || old.Lock == key;
|
||||
}
|
||||
|
||||
/// <summary> Copy the settings of an existing (sourceMod != null) or stored (sourceName) mod to another mod, if they exist. </summary>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public sealed class ModGroupDrawer(Configuration config, CollectionManager colle
|
|||
_blockGroupCache.Clear();
|
||||
_tempSettings = tempSettings;
|
||||
_temporary = tempSettings != null;
|
||||
_locked = (tempSettings?.Lock ?? 0) != 0;
|
||||
_locked = (tempSettings?.Lock ?? 0) > 0;
|
||||
var useDummy = true;
|
||||
foreach (var (group, idx) in mod.Groups.WithIndex())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
private void RemoveTemporarySettings(FileSystem<Mod>.Leaf mod)
|
||||
{
|
||||
var tempSettings = _collectionManager.Active.Current.GetTempSettings(mod.Value.Index);
|
||||
if (tempSettings is { Lock: 0 })
|
||||
if (tempSettings is { Lock: <= 0 })
|
||||
if (ImUtf8.MenuItem("Remove Temporary Settings"))
|
||||
_collectionManager.Editor.SetTemporarySettings(_collectionManager.Active.Current, mod.Value, null);
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
private void DisableTemporarily(FileSystem<Mod>.Leaf mod)
|
||||
{
|
||||
var tempSettings = _collectionManager.Active.Current.GetTempSettings(mod.Value.Index);
|
||||
if (tempSettings == null || tempSettings.Lock == 0)
|
||||
if (tempSettings is not { Lock: > 0 })
|
||||
if (ImUtf8.MenuItem("Disable Temporarily"))
|
||||
_collectionManager.Editor.SetTemporarySettings(_collectionManager.Active.Current, mod.Value,
|
||||
TemporaryModSettings.DefaultSettings(mod.Value, "User Context-Menu"));
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class ModPanelSettingsTab(
|
|||
|
||||
_inherited = selection.Collection != collectionManager.Active.Current;
|
||||
_temporary = selection.TemporarySettings != null;
|
||||
_locked = (selection.TemporarySettings?.Lock ?? 0) != 0;
|
||||
_locked = (selection.TemporarySettings?.Lock ?? 0) > 0;
|
||||
DrawTemporaryWarning();
|
||||
DrawInheritedWarning();
|
||||
UiHelpers.DefaultLineSpace();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue