Fix Item Swaps not updating when mod is changed.

This commit is contained in:
Ottermandias 2023-03-31 01:27:27 +02:00
parent afa11f85e2
commit 2ffbd7beba

View file

@ -55,6 +55,7 @@ public class ItemSwapTab : IDisposable, ITab
_communicator.CollectionChange.Event += OnCollectionChange;
_collectionManager.Current.ModSettingChanged += OnSettingChange;
_communicator.ModOptionChanged.Event += OnModOptionChange;
}
/// <summary> Update the currently selected mod or its settings. </summary>
@ -99,6 +100,7 @@ public class ItemSwapTab : IDisposable, ITab
{
_communicator.CollectionChange.Event -= OnCollectionChange;
_collectionManager.Current.ModSettingChanged -= OnSettingChange;
_communicator.ModOptionChanged.Event -= OnModOptionChange;
}
private enum SwapType
@ -753,4 +755,12 @@ public class ItemSwapTab : IDisposable, ITab
_swapData.LoadMod(_mod, _modSettings);
_dirty = true;
}
private void OnModOptionChange(ModOptionChangeType type, Mod mod, int a, int b, int c)
{
if (type is ModOptionChangeType.PrepareChange || mod != _mod)
return;
_swapData.LoadMod(_mod, _modSettings);
_dirty = true;
}
}