From c1cd4a7d67dbf3fe06cf7b22c1feffd5a26964c8 Mon Sep 17 00:00:00 2001 From: Az <56699741+AlchlcDvl@users.noreply.github.com> Date: Sun, 27 Sep 2026 23:24:57 -0400 Subject: [PATCH] fix small overlooked behaviours - fixes issue #45 where the player leave event was in a postfix, when the player character was already destroyed - fixes #46 where modded role options did not have the same change zero behaviour as vanilla ones --- MiraAPI/Patches/AmongUsClientSyncPatch.cs | 2 +- MiraAPI/Patches/Options/OptionsPatches.cs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/MiraAPI/Patches/AmongUsClientSyncPatch.cs b/MiraAPI/Patches/AmongUsClientSyncPatch.cs index a8a3dfe..926004d 100644 --- a/MiraAPI/Patches/AmongUsClientSyncPatch.cs +++ b/MiraAPI/Patches/AmongUsClientSyncPatch.cs @@ -36,7 +36,7 @@ internal static class AmongUsClientSyncPatch GameModeOption.RpcSyncGamemode(PlayerControl.LocalPlayer, GameModeOption.Value); } - [HarmonyPostfix] + [HarmonyPrefix] [HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnPlayerLeft))] public static void PlayerLeftPatch(ClientData data, DisconnectReasons reason) { diff --git a/MiraAPI/Patches/Options/OptionsPatches.cs b/MiraAPI/Patches/Options/OptionsPatches.cs index 64d9119..e99a893 100644 --- a/MiraAPI/Patches/Options/OptionsPatches.cs +++ b/MiraAPI/Patches/Options/OptionsPatches.cs @@ -34,6 +34,11 @@ public static class OptionsPatches __instance.roleChance = 0; } + if (__instance.roleChance == 0) + { + __instance.roleMaxCount = 0; + } + __instance.OnValueChanged.Invoke(__instance); return false; } @@ -60,6 +65,11 @@ public static class OptionsPatches __instance.roleChance = 100; } + if (__instance.roleChance == 0) + { + __instance.roleMaxCount = 0; + } + __instance.OnValueChanged.Invoke(__instance); return false; } @@ -84,6 +94,11 @@ public static class OptionsPatches __instance.roleMaxCount = 0; } + if (__instance.roleMaxCount == 0) + { + __instance.roleChance = 0; + } + __instance.OnValueChanged.Invoke(__instance); return false; } @@ -108,6 +123,11 @@ public static class OptionsPatches __instance.roleMaxCount = __instance.role.MaxCount; } + if (__instance.roleMaxCount == 0) + { + __instance.roleChance = 0; + } + __instance.OnValueChanged.Invoke(__instance); return false; }