Skip to content

Commit

Permalink
Fixed a nullptrexception + sheriff being able to use the kill button …
Browse files Browse the repository at this point in the history
…while in meeting
  • Loading branch information
Brybry16 committed Feb 17, 2021
1 parent e2c8c13 commit 9d3ed0c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ReactorSheriff/HudManagerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class HudManagerPatch
static System.Random random = new System.Random();
static string GameSettingsText = null;

public static bool isMeetingHudActive;



Expand Down Expand Up @@ -55,7 +56,11 @@ public static void updateMeetingHud(MeetingHud __instance)
{
foreach (PlayerVoteArea playerVoteArea in __instance.playerStates)
{
if (playerVoteArea.NameText.Text == PlayerControlPatch.Sheriff.name)
if (PlayerControlPatch.Sheriff == null)
{
SheriffReactorMod.log.LogMessage("PlayerControlPatch.Sheriff IS NULL CT CA MDR");
}
if (PlayerControlPatch.Sheriff != null && playerVoteArea.NameText.Text == PlayerControlPatch.Sheriff.name)
{
if (CustomGameOptions.ShowSheriff | PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
{
Expand All @@ -69,7 +74,9 @@ public static void updateMeetingHud(MeetingHud __instance)
public static void Postfix(HudManager __instance)
{
KillButton = __instance.KillButton;
if (MeetingHud.Instance != null)
isMeetingHudActive = MeetingHud.Instance != null;

if (isMeetingHudActive)
{
updateMeetingHud(MeetingHud.Instance);
}
Expand All @@ -83,7 +90,7 @@ public static void Postfix(HudManager __instance)
{

PlayerControl.LocalPlayer.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
if (PlayerControl.LocalPlayer.Field_6.IsDead || PlayerControlPatch.sheriffInTask)
if (PlayerControl.LocalPlayer.Field_6.IsDead || PlayerControlPatch.sheriffInTask || isMeetingHudActive)
{
KillButton.gameObject.SetActive(false);
KillButton.isActive = false;
Expand Down Expand Up @@ -147,7 +154,6 @@ public static void Postfix(MeetingHud __instance)
{
PlayerControlPatch.lastKilled = DateTime.UtcNow;
PlayerControlPatch.lastKilled = PlayerControlPatch.lastKilled.AddSeconds(8);

}
}
}

0 comments on commit 9d3ed0c

Please sign in to comment.