Revert "null checks and error fixes"

This reverts commit 0c590ad263.
This commit is contained in:
D1GQ committed 2024-07-27 23:24:42 -05:00
1 parent 0c590ad263
commit 2141a2c15f
2 files changed
+24 -28

No files matched your search

+2 -2
View File
@@ -70,7 +70,7 @@ class PlayerControlPatch
public static void SetPlayerInfo(PlayerControl player)
{
if (player == null || player.Data == null) return;
if (player == null) return;
// Set player text info
if (player.DataIsCollected() != true)
@@ -203,7 +203,7 @@ class PlayerControlPatch
string Role = $"<color={player.GetTeamHexColor()}>{player.GetRoleName()}</color>";
if (!player.IsImpostorTeammate())
{
if (PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer.IsAlive() && player != PlayerControl.LocalPlayer)
if (PlayerControl.LocalPlayer.IsAlive() && player != PlayerControl.LocalPlayer)
{
if (!DebugMenu.RevealRoles)
{
+22 -26
View File
@@ -10,34 +10,30 @@ class OnGameJoinedPatch
{
public static void Postfix(/*AmongUsClient __instance*/)
{
try
PlayerControlPatch.infotime = 0f;
AntiCheat.PauseAntiCheat();
// Fix host icon in lobby on modded servers
if (!GameStates.IsVanillaServer)
{
PlayerControlPatch.infotime = 0f;
AntiCheat.PauseAntiCheat();
// Fix host icon in lobby on modded servers
if (!GameStates.IsVanillaServer)
{
var host = AmongUsClient.Instance.GetHost().Character;
host.SetColor(-2);
host.SetColor(host.CurrentOutfit.ColorId);
}
_ = new LateTask(() =>
{
// Send Better Among Us Check RPC
if (GameStates.IsInGame)
{
MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.BetterCheck, SendOption.None, -1);
messageWriter.Write((byte)PlayerControl.LocalPlayer.NetId);
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
}
}, 1.5f, "OnGameJoinedPatch");
Logger.Log($"Successfully joined {GameCode.IntToGameName(AmongUsClient.Instance.GameId)}", "OnGameJoinedPatch");
var host = AmongUsClient.Instance.GetHost().Character;
host.SetColor(-2);
host.SetColor(host.CurrentOutfit.ColorId);
}
catch { };
_ = new LateTask(() =>
{
// Send Better Among Us Check RPC
if (GameStates.IsInGame)
{
MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.BetterCheck, SendOption.None, -1);
messageWriter.Write((byte)PlayerControl.LocalPlayer.NetId);
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
}
}, 1.5f, "OnGameJoinedPatch");
Logger.Log($"Successfully joined {GameCode.IntToGameName(AmongUsClient.Instance.GameId)}", "OnGameJoinedPatch");
}
}
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnPlayerJoined))]