static void Prefix(Player player) { if (player == MPObserver.ObservedPlayer) { MPObserver.SetObservedPlayer(null); } }
static void Postfix(CCInput cc_type) { if (MPObserver.Enabled && GameplayManager.IsMultiplayerActive) { if (cc_type == CCInput.SWITCH_WEAPON && Controls.JustPressed(CCInput.SWITCH_WEAPON)) { MPObserver.SwitchObservedPlayer(false); } if (cc_type == CCInput.PREV_WEAPON && Controls.JustPressed(CCInput.PREV_WEAPON)) { MPObserver.SwitchObservedPlayer(true); } if (cc_type == CCInput.FIRE_WEAPON && Controls.JustPressed(CCInput.FIRE_WEAPON) && MPObserver.ObservedPlayer != null) { MPObserver.SetObservedPlayer(null); } if (cc_type == CCInput.FIRE_MISSILE && Controls.JustPressed(CCInput.FIRE_MISSILE) && MPObserver.ObservedPlayer != null) { MPObserver.ThirdPerson = !MPObserver.ThirdPerson; MPObserver.SetPlayerVisibility(MPObserver.ObservedPlayer, MPObserver.ThirdPerson); GameManager.m_viewer.SetDamageEffects(-999); } if (cc_type == CCInput.SWITCH_MISSILE && Controls.JustPressed(CCInput.SWITCH_MISSILE) && CTF.IsActive) { var player = (from f in CTF.PlayerHasFlag join p in Overload.NetworkManager.m_Players on f.Key equals p.netId where p.m_mp_team == MpTeam.TEAM0 select p).FirstOrDefault(); if (player == null) { GameplayManager.AddHUDMessage($"No {MPTeams.TeamName(MpTeam.TEAM0)} player is carrying a flag."); } else { MPObserver.SetObservedPlayer(player); } } if (cc_type == CCInput.PREV_MISSILE && Controls.JustPressed(CCInput.PREV_MISSILE) && CTF.IsActive) { var player = (from f in CTF.PlayerHasFlag join p in Overload.NetworkManager.m_Players on f.Key equals p.netId where p.m_mp_team == MpTeam.TEAM1 select p).FirstOrDefault(); if (player == null) { GameplayManager.AddHUDMessage($"No {MPTeams.TeamName(MpTeam.TEAM1)} player is carrying a flag."); } else { MPObserver.SetObservedPlayer(player); } } } }