From fab1e551fd8f4765677eedb66fd83c852601d1f1 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Wed, 26 Jun 2024 00:03:43 +0300 Subject: [PATCH 1/5] Fixed test module creation --- .../Bannerlord.ButterLib.HotKeys.Test.csproj | 1 + .../Bannerlord.ButterLib.ObjectSystem.Test.csproj | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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) From 9b900843ad06136cad9265a798d6fae4a51748dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Jun 2024 00:14:10 +0000 Subject: [PATCH 2/5] Automated dotnet-format update --- .../MBSubModuleBaseExtended/Patches/ModulePatch.cs | 2 +- .../ObjectSystem/MBObjectFinder.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 en && en.FirstOrDefault(o => o.Id == id) is { } result) { return result; From d93a8b388cb318c3f2446cc8f5274e2a3d7a2840 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 04:56:01 +0000 Subject: [PATCH 3/5] Bump danielpalme/ReportGenerator-GitHub-Action from 5.3.6 to 5.3.7 Bumps [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/reportgenerator-github-action) from 5.3.6 to 5.3.7. - [Release notes](https://github.com/danielpalme/reportgenerator-github-action/releases) - [Commits](https://github.com/danielpalme/reportgenerator-github-action/compare/5.3.6...5.3.7) --- updated-dependencies: - dependency-name: danielpalme/ReportGenerator-GitHub-Action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/test-full.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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' From 88af0a0b135c1573f1f56e2bcb37dea1a2fc5778 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Mon, 1 Jul 2024 10:14:46 +0300 Subject: [PATCH 4/5] Test fix --- .../HotKeys/HotKeyManagerImplementation.cs | 6 +++--- .../ObjectSystem/MBObjectExtensionDataStore.cs | 4 ++-- supported-game-versions.txt | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) 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/ObjectSystem/MBObjectExtensionDataStore.cs b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs index 03147a1e..b167ae58 100755 --- a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs +++ b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs @@ -106,9 +106,9 @@ private sealed record DataKey([field: SaveableField(0)] MBGUID ObjectId, [field: public override string ToString() => $"{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/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 From ffba1014e7f8faa2bb7a404fa9be87e67695656b Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Tue, 2 Jul 2024 14:26:15 +0300 Subject: [PATCH 5/5] Fixed double key press issue SubSystems will not be enabled/disabled multiple times now --- build/common.props | 2 +- changelog.txt | 4 ++++ .../DistanceMatrix/DistanceMatrixSubSystem.cs | 10 ++++++---- .../HotKeys/HotKeySubSystem.cs | 2 ++ .../MBSubModuleBaseExSubSystem.cs | 3 +++ .../ObjectSystem/ObjectSystemSubSystem.cs | 2 ++ .../SaveSystem/SaveSystemSubSystem.cs | 2 ++ .../CrashUploader/CrashUploaderSubSystem.cs | 2 ++ .../ExceptionHandler/ExceptionHandlerSubSystem.cs | 2 ++ 9 files changed, 24 insertions(+), 5 deletions(-) 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/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/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();