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
This commit is contained in:
Az committed 2026-09-27 23:24:57 -04:00
1 parent bfee7d44a2
commit c1cd4a7d67
2 files changed
+21 -1

No files matched your search

+1 -1
View File
@@ -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)
{
+20
View File
@@ -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;
}