From f4e8e204f94a7fb51d718517c890dd830b1e38ba Mon Sep 17 00:00:00 2001 From: D1GQ <83262852+D1GQ@users.noreply.github.com> Date: Sat, 27 Jul 2024 13:40:13 -0500 Subject: [PATCH] Added IsInVanish on PlayerControl --- Modules/ExtendedPlayerControl.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 02f249f..fe71a7e 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -127,6 +127,15 @@ static class ExtendedPlayerControl public static string GetRoleName(this PlayerControl player) => player?.Data != null && Main.GetRoleName.TryGetValue((int)player.Data.RoleType, out var roleName) ? roleName : string.Empty; // Check if player is Shapeshifting public static bool IsInShapeshift(this PlayerControl player) => player != null && (player.shapeshiftTargetPlayerId > -1 || player.shapeshifting); + // Check if player is in vanish + public static bool IsInVanish(this PlayerControl player) + { + if (player != null && player.Data.Role is PhantomRole phantomRole) + { + return phantomRole.fading; + } + return false; + } // Check if player is on imposter team public static bool IsImpostorTeam(this PlayerControl player) => player?.Data != null && (player.Data.RoleType is RoleTypes.Impostor or RoleTypes.ImpostorGhost or RoleTypes.Shapeshifter or RoleTypes.Phantom); // Check if player is a imposter teammate