diff --git a/Penumbra/Api/Api/TemporaryApi.cs b/Penumbra/Api/Api/TemporaryApi.cs index afddeae8..b12ce707 100644 --- a/Penumbra/Api/Api/TemporaryApi.cs +++ b/Penumbra/Api/Api/TemporaryApi.cs @@ -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; } diff --git a/Penumbra/Collections/Manager/CollectionEditor.cs b/Penumbra/Collections/Manager/CollectionEditor.cs index 124f8cf7..437d4e0b 100644 --- a/Penumbra/Collections/Manager/CollectionEditor.cs +++ b/Penumbra/Collections/Manager/CollectionEditor.cs @@ -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; } /// Copy the settings of an existing (sourceMod != null) or stored (sourceName) mod to another mod, if they exist. diff --git a/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs b/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs index 527d8bce..b723978b 100644 --- a/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs +++ b/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs @@ -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()) { diff --git a/Penumbra/UI/ModsTab/ModFileSystemSelector.cs b/Penumbra/UI/ModsTab/ModFileSystemSelector.cs index c3cb211c..091a2937 100644 --- a/Penumbra/UI/ModsTab/ModFileSystemSelector.cs +++ b/Penumbra/UI/ModsTab/ModFileSystemSelector.cs @@ -269,7 +269,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector.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.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")); diff --git a/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs b/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs index cf64c00a..60666810 100644 --- a/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs +++ b/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs @@ -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();