diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index a60eb858..c946da38 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -71,7 +71,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.3.6 + uses: danielpalme/ReportGenerator-GitHub-Action@5.3.7 with: reports: '*.xml' targetdir: 'coveragereport' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89c11895..c4fb1334 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.3.6 + uses: danielpalme/ReportGenerator-GitHub-Action@5.3.7 with: reports: 'coverage_butterlib_stable_debug.xml;coverage_butterlib_stable_release.xml;coverage_butterlib_impl_stable_debug.xml;coverage_butterlib_impl_stable_release.xml;coverage_butterlib_impl_beta_debug.xml;coverage_butterlib_impl_beta_release.xml;' targetdir: 'coveragereport' diff --git a/build/common.props b/build/common.props index 8880471c..58d92ec7 100644 --- a/build/common.props +++ b/build/common.props @@ -5,7 +5,7 @@ 1.0.0 - 2.9.9 + 2.9.10 2.2.2 3.2.0.77 diff --git a/changelog.txt b/changelog.txt index 8d0caf23..200a5f47 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ --------------------------------------------------------------------------------------------------- +Version: 2.9.10 +Game Versions: v1.0.x,v1.1.x,v1.2.x +* Fixed double key press issue +--------------------------------------------------------------------------------------------------- Version: 2.9.9 Game Versions: v1.0.x,v1.1.x,v1.2.x * Fixed SyncAsJson not serializing game types diff --git a/src/Bannerlord.ButterLib.Implementation/DistanceMatrix/DistanceMatrixSubSystem.cs b/src/Bannerlord.ButterLib.Implementation/DistanceMatrix/DistanceMatrixSubSystem.cs index f52f0b4f..8ddf23f7 100644 --- a/src/Bannerlord.ButterLib.Implementation/DistanceMatrix/DistanceMatrixSubSystem.cs +++ b/src/Bannerlord.ButterLib.Implementation/DistanceMatrix/DistanceMatrixSubSystem.cs @@ -25,16 +25,18 @@ public DistanceMatrixSubSystem() public void Enable() { - if (GameInitialized) - return; + if (IsEnabled) return; + + if (GameInitialized) return; IsEnabled = true; } public void Disable() { - if (GameInitialized) - return; + if (!IsEnabled) return; + + if (GameInitialized) return; IsEnabled = false; } diff --git a/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs b/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs index 1cb8f2b5..cec28adb 100644 --- a/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs +++ b/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs @@ -51,9 +51,9 @@ public override IReadOnlyList Build() var hotKeyCategoryContainer = new HotKeyCategoryContainer(_modName, _categoryName, _instanceHotKeys); -#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115 - TWHotKeyManager.RegisterInitialContexts(new[] { hotKeyCategoryContainer }, true); -#elif v120 || v121 || v122 || v123 || v124 || v125 || v126 || v127 || v128 || v129 +#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115 || v116 + TWHotKeyManager.RegisterInitialContexts(new[] { hotKeyCategoryContainer }, true); +#elif v120 || v121 || v122 || v123 || v124 || v125 || v126 || v127 || v128 || v129 || v1210 TWHotKeyManager.RegisterInitialContexts(TWHotKeyManager.GetAllCategories().ToList().Concat(new[] { hotKeyCategoryContainer }), true); #else #error DEFINE diff --git a/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeySubSystem.cs b/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeySubSystem.cs index c060f692..f7dbd016 100644 --- a/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeySubSystem.cs +++ b/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeySubSystem.cs @@ -33,6 +33,7 @@ public HotKeySubSystem() public void Enable() { + if (IsEnabled) return; IsEnabled = true; if (ButterLibSubModule.Instance is { } instance) @@ -43,6 +44,7 @@ public void Enable() public void Disable() { + if (!IsEnabled) return; IsEnabled = false; if (ButterLibSubModule.Instance is { } instance) diff --git a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs index 123eb344..50ac6455 100644 --- a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs +++ b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs @@ -29,6 +29,7 @@ public MBSubModuleBaseExSubSystem() } public void Enable() { + if (IsEnabled) return; IsEnabled = true; ModulePatch.Enable(_harmony); @@ -40,7 +41,9 @@ public void Enable() } public void Disable() { + if (!IsEnabled) return; IsEnabled = false; + ModulePatch.Disable(_harmony); MBGameManagerPatch.Disable(_harmony); // Think about DelayedSubModuleManager.Unregister diff --git a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs index f82420e0..ee5ce4f6 100644 --- a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs +++ b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs @@ -81,7 +81,7 @@ public static IEnumerable Transpiler(IEnumerable $"{ObjectId}::{Key}"; } -#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115 +#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115 || v116 private sealed class SavedTypeDefiner : SaveableCampaignBehaviorTypeDefiner -#elif v120 || v121 || v122 || v123 || v124 || v125 || v126 || v127 || v128 || v129 +#elif v120 || v121 || v122 || v123 || v124 || v125 || v126 || v127 || v128 || v129 || v1210 private sealed class SavedTypeDefiner : SaveableTypeDefiner #else #error DEFINE diff --git a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectFinder.cs b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectFinder.cs index 88dbd0a5..9cf8aa23 100644 --- a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectFinder.cs +++ b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectFinder.cs @@ -29,7 +29,7 @@ internal class MBObjectFinder : IMBObjectFinder foreach (var cot in CampaignObjectTypeObjects?.Invoke(Campaign.Current.CampaignObjectManager) ?? []) { if (cot is null) continue; - + if (ObjectClassGetter?.Invoke(cot, []) is Type objType && objType == type && cot is IEnumerable en && en.FirstOrDefault(o => o.Id == id) is { } result) { return result; diff --git a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/ObjectSystemSubSystem.cs b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/ObjectSystemSubSystem.cs index 5f774076..49b70b82 100644 --- a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/ObjectSystemSubSystem.cs +++ b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/ObjectSystemSubSystem.cs @@ -25,6 +25,7 @@ public ObjectSystemSubSystem() public void Enable() { + if (IsEnabled) return; IsEnabled = true; CampaignBehaviorManagerPatch.Enable(_harmony); @@ -32,6 +33,7 @@ public void Enable() public void Disable() { + if (!IsEnabled) return; IsEnabled = false; CampaignBehaviorManagerPatch.Disable(_harmony); diff --git a/src/Bannerlord.ButterLib.Implementation/SaveSystem/SaveSystemSubSystem.cs b/src/Bannerlord.ButterLib.Implementation/SaveSystem/SaveSystemSubSystem.cs index 24c06fdd..db23a62d 100644 --- a/src/Bannerlord.ButterLib.Implementation/SaveSystem/SaveSystemSubSystem.cs +++ b/src/Bannerlord.ButterLib.Implementation/SaveSystem/SaveSystemSubSystem.cs @@ -29,6 +29,7 @@ public SaveSystemSubSystem() public void Enable() { + if (IsEnabled) return; IsEnabled = true; BehaviourNamePatch.Enable(_harmony); // Fixes possible collision with save names @@ -38,6 +39,7 @@ public void Enable() public void Disable() { + if (!IsEnabled) return; IsEnabled = false; BehaviourNamePatch.Disable(_harmony); diff --git a/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderSubSystem.cs b/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderSubSystem.cs index c5f7ee23..73cdb9cb 100644 --- a/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderSubSystem.cs +++ b/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderSubSystem.cs @@ -21,11 +21,13 @@ public CrashUploaderSubSystem() public void Enable() { + if (IsEnabled) return; IsEnabled = true; } public void Disable() { + if (!IsEnabled) return; IsEnabled = false; } } \ No newline at end of file diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs b/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs index 58010322..2cbd2ff1 100644 --- a/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs +++ b/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs @@ -73,6 +73,7 @@ public ExceptionHandlerSubSystem() public void Enable() { + if (IsEnabled) return; IsEnabled = true; if (!BEWPatch.IsDebuggerAttached()) @@ -87,6 +88,7 @@ public void Enable() public void Disable() { + if (!IsEnabled) return; IsEnabled = false; UnsubscribeToUnhandledException(); diff --git a/supported-game-versions.txt b/supported-game-versions.txt index 937ad2a5..327200c5 100644 --- a/supported-game-versions.txt +++ b/supported-game-versions.txt @@ -1,3 +1,4 @@ +v1.2.10 v1.2.9 v1.2.8 v1.2.7 diff --git a/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj b/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj index e9f37eba..56d8b2e6 100644 --- a/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj +++ b/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj @@ -13,6 +13,7 @@ false true + $(MSBuildProjectName) $(MSBuildProjectName) diff --git a/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj b/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj index fc7d1903..18dc22d8 100644 --- a/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj +++ b/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj @@ -12,7 +12,8 @@ false true - + + $(MSBuildProjectName) $(MSBuildProjectName)