Added IsInVanish on PlayerControl

This commit is contained in:
D1GQ authored and GitHub committed 2024-07-27 13:40:13 -05:00
1 parent 8fd4d70590
commit f4e8e204f9
1 file changed
+9
+9
View File
@@ -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