Allow non-locking, negative identifier-locks

This commit is contained in:
Ottermandias 2024-12-31 16:36:46 +01:00
parent 5f9cbe9ab1
commit cff482a2ed
5 changed files with 7 additions and 7 deletions

View file

@ -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())
{

View file

@ -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"));

View file

@ -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();