- Weird LuaCs Settings Menu bug present: package is loaded on startup but is then unloaded if the settingsmenu is opened and the package is not in the enabled list.

This commit is contained in:
Maplewheels
2026-02-28 22:10:29 -05:00
parent 28b355911d
commit 09bc2d0891
9 changed files with 52 additions and 191 deletions
@@ -30,12 +30,14 @@ public abstract class SettingBase : ISettingBase
}
private int _isDisposed = 0;
protected virtual bool IsDisposed
public virtual bool IsDisposed
{
get => ModUtils.Threading.GetBool(ref _isDisposed);
private set => ModUtils.Threading.SetBool(ref _isDisposed, value);
}
protected abstract void OnDispose();
public virtual void Dispose()
{
if (!ModUtils.Threading.CheckIfClearAndSetBool(ref _isDisposed))
@@ -43,8 +45,8 @@ public abstract class SettingBase : ISettingBase
return;
}
OnDispose();
ConfigInfo = null;
OnValueChanged = null;
GC.SuppressFinalize(this);
}
@@ -55,6 +57,6 @@ public abstract class SettingBase : ISettingBase
public abstract string GetDefaultStringValue();
public abstract bool TrySetValue(OneOf<string, XElement> value);
public event Action<ISettingBase> OnValueChanged;
public abstract event Action<ISettingBase> OnValueChanged;
public abstract OneOf<string, XElement> GetSerializableValue();
}