diff --git a/EXILED/Exiled.API/Extensions/RoleExtensions.cs b/EXILED/Exiled.API/Extensions/RoleExtensions.cs index c674af1bf..f9e86fa1a 100644 --- a/EXILED/Exiled.API/Extensions/RoleExtensions.cs +++ b/EXILED/Exiled.API/Extensions/RoleExtensions.cs @@ -123,6 +123,48 @@ public static bool TryGetRoleBase(this RoleTypeId roleType, out T roleBase) /// Returns whether is an or not. public static bool IsFpcRole(this RoleTypeId roleType) => roleType.GetRoleBase() is IFpcRole; + /// + /// Checks if the role is an SCP role. + /// + /// The . + /// A boolean which is true when the role is an SCP role. + public static bool IsScp(this RoleTypeId roleType) => roleType.GetTeam() == Team.SCPs; + + /// + /// Checks if the role is a dead role. + /// + /// The . + /// A boolean which is true when the role is a dead role. + public static bool IsDead(this RoleTypeId roleType) => roleType.GetTeam() == Team.Dead; + + /// + /// Checks if the role is an NTF role. + /// + /// The . + /// A boolean which is true when the role is an NTF role. Does not include Facility Guards. + public static bool IsNtf(this RoleTypeId roleType) => roleType.GetTeam() == Team.FoundationForces && roleType != RoleTypeId.FacilityGuard; + + /// + /// Checks if the role is a Chaos role. + /// + /// The . + /// A boolean which is true when the role is a Chaos role. + public static bool IsChaos(this RoleTypeId roleType) => roleType.GetTeam() == Team.ChaosInsurgency; + + /// + /// Checks if the role is a military role (Chaos Insurgency or NTF). + /// + /// The . + /// A boolean which is true when the role is a military role. Does not include Facility Guards. + public static bool IsMilitary(this RoleTypeId roleType) => roleType.IsNtf() || roleType.IsChaos(); + + /// + /// Checks if the role is a civilian role (Scientists and Class-D). + /// + /// The . + /// A boolean which is true when the role is a civilian role. + public static bool IsCivilian(this RoleTypeId roleType) => roleType == RoleTypeId.ClassD || roleType == RoleTypeId.Scientist; + /// /// Gets a random spawn point of a . /// diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index c6cd27514..9cc1758f1 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -699,7 +699,7 @@ public ScpSpawnPreferences.SpawnPreferences ScpPreferences /// Gets a value indicating whether or not the player's is any SCP. /// Equivalent to checking the player's . /// - public bool IsScp => Role?.Team is Team.SCPs; + public bool IsScp => Role?.Type.IsScp() ?? false; /// /// Gets a value indicating whether or not the player's is any human rank.