1- using Exiled . API . Enums ;
1+ using System . ComponentModel ;
2+ using Exiled . API . Enums ;
23using Exiled . API . Features ;
34using Exiled . API . Features . Items ;
45using PlayerRoles ;
@@ -10,7 +11,7 @@ namespace ExtendedItems
1011 public static class Utils
1112 {
1213 /// <summary>
13- /// Calculates the global coords of a point inside a room based on the room type and the location
14+ /// Calculates the global coords of a point inside a room based on the room type and the location
1415 /// </summary>
1516 /// <param name="roomType"></param>
1617 /// <param name="localPos"></param>
@@ -57,7 +58,11 @@ public static ushort Subtract(ushort input, int mask = 1)
5758 // ReSharper disable once InconsistentNaming
5859 public static bool PDWarning ( EP player )
5960 {
60- return ( from actEffects in player . ActiveEffects let Larry = EP . List . First ( L => L . Role == RoleTypeId . Scp106 ) . Position select actEffects . name == "Corroding" && Plugin . Instance != null && Vector3 . Distance ( player . Position , Larry ) < Plugin . Instance . Config . LarryDistance ) . FirstOrDefault ( ) ;
61+ return ( from actEffects in player . ActiveEffects
62+ let Larry = EP . List . First ( L => L . Role == RoleTypeId . Scp106 ) . Position
63+ select actEffects . name == "Corroding" && Plugin . Instance != null &&
64+ Vector3 . Distance ( player . Position , Larry ) < Plugin . Instance . Config . LarryDistance )
65+ . FirstOrDefault ( ) ;
6166 }
6267
6368 public static void Exploding ( EP player )
@@ -66,5 +71,10 @@ public static void Exploding(EP player)
6671 grenade . FuseTime = 0.1f ;
6772 grenade . SpawnActive ( player . Position + new Vector3 ( 0 , 1 , 0 ) , player ) ;
6873 }
74+
75+ public static bool HasEffect ( EP player , EffectType effect )
76+ {
77+ return ! Enum . IsDefined ( typeof ( EffectType ) , effect ) ? throw new InvalidEnumArgumentException ( nameof ( effect ) , ( int ) effect , typeof ( EffectType ) ) : player . ActiveEffects . Any ( targetActiveEffect => targetActiveEffect . name == nameof ( effect ) ) ;
78+ }
6979 }
7080}
0 commit comments