Fix bug with default mod settings other than 0.

This commit is contained in:
Ottermandias 2023-03-25 12:53:47 +01:00
parent fb2fe05409
commit d58a3e0fe7
2 changed files with 13 additions and 14 deletions

View file

@ -93,16 +93,15 @@ public partial class ModCollection
public bool SetModSetting( int idx, int groupIdx, uint newValue )
{
var settings = _settings[ idx ] != null ? _settings[ idx ]!.Settings : this[ idx ].Settings?.Settings;
var oldValue = settings?[ groupIdx ] ?? 0;
if( oldValue != newValue )
{
var inheritance = FixInheritance( idx, false );
_settings[ idx ]!.SetValue( Penumbra.ModManager[ idx ], groupIdx, newValue );
ModSettingChanged.Invoke( ModSettingChange.Setting, idx, inheritance ? -1 : ( int )oldValue, groupIdx, false );
return true;
}
var oldValue = settings?[ groupIdx ] ?? Penumbra.ModManager[idx].Groups[groupIdx].DefaultSettings;
if (oldValue == newValue)
return false;
var inheritance = FixInheritance( idx, false );
_settings[ idx ]!.SetValue( Penumbra.ModManager[ idx ], groupIdx, newValue );
ModSettingChanged.Invoke( ModSettingChange.Setting, idx, inheritance ? -1 : ( int )oldValue, groupIdx, false );
return true;
return false;
}
// Change one of the available mod settings for mod idx discerned by type.

View file

@ -122,11 +122,11 @@ public class ModPanelSettingsTab : ITab
private void DrawEnabledInput()
{
var enabled = _settings.Enabled;
if (ImGui.Checkbox("Enabled", ref enabled))
{
_modManager.NewMods.Remove(_selector.Selected!);
_collectionManager.Current.SetModState(_selector.Selected!.Index, enabled);
}
if (!ImGui.Checkbox("Enabled", ref enabled))
return;
_modManager.NewMods.Remove(_selector.Selected!);
_collectionManager.Current.SetModState(_selector.Selected!.Index, enabled);
}
/// <summary>