diff --git a/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs b/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs new file mode 100644 index 0000000..a276946 --- /dev/null +++ b/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs @@ -0,0 +1,16 @@ +using HarmonyLib; +using MiraAPI.Utilities; + +namespace MiraAPI.Patches.Voting; + +[HarmonyPatch(typeof(DummyBehaviour), nameof(DummyBehaviour.Update))] +internal static class DummyBehaviourPatch +{ + public static void Postfix(DummyBehaviour __instance) + { + if (MeetingHud.Instance && __instance.myPlayer.GetVoteData()) + { + __instance.voted = __instance.myPlayer.GetVoteData().VotesRemaining == 0; + } + } +} diff --git a/MiraAPI/Patches/Voting/MeetingHudPatches.cs b/MiraAPI/Patches/Voting/MeetingHudPatches.cs index 42712e4..6070b1e 100644 --- a/MiraAPI/Patches/Voting/MeetingHudPatches.cs +++ b/MiraAPI/Patches/Voting/MeetingHudPatches.cs @@ -47,7 +47,7 @@ internal static class MeetingHudPatches } [HarmonyPrefix] - [HarmonyPatch(nameof(MeetingHud.HandleDisconnect), [typeof(PlayerControl), typeof(DisconnectReasons)])] + [HarmonyPatch(nameof(MeetingHud.HandleDisconnect), typeof(PlayerControl), typeof(DisconnectReasons))] public static bool HandleDisconnect(MeetingHud __instance, PlayerControl pc) { if (!AmongUsClient.Instance.AmHost || __instance.playerStates is null || !pc || !GameData.Instance)