fix black screen when no role assigned

This commit is contained in:
Gurge44 committed 2025-03-26 13:04:28 +01:00
1 parent 7a0d00866f
commit 6e130c28bf
7 files changed
+96 -84

No files matched your search

+11 -2
View File
@@ -338,8 +338,17 @@ internal static class ExtendedPlayerControl
if (setRoleMap)
{
(byte, byte) key = (player.PlayerId, GetClientById(clientId).Character.PlayerId);
StartGameHostPatch.RpcSetRoleReplacer.RoleMap[key] = (role, StartGameHostPatch.RpcSetRoleReplacer.RoleMap[key].CustomRole);
try
{
(byte, byte) key = (player.PlayerId, GetClientById(clientId).Character.PlayerId);
if (StartGameHostPatch.RpcSetRoleReplacer.RoleMap.TryGetValue(key, out var pair))
{
pair.RoleType = role;
StartGameHostPatch.RpcSetRoleReplacer.RoleMap[key] = pair;
}
}
catch (Exception e) { ThrowException(e); }
}
if (AmongUsClient.Instance.ClientId == clientId)