@@ -10,6 +10,7 @@ namespace Exiled.Events.Handlers
1010#pragma warning disable SA1623 // Property summary documentation should match accessors
1111
1212 using Exiled . API . Features . Pickups ;
13+ using Exiled . API . Features . Pickups . Projectiles ;
1314 using Exiled . Events . EventArgs . Map ;
1415 using Exiled . Events . Features ;
1516
@@ -130,6 +131,11 @@ public static class Map
130131 /// </summary>
131132 public static Event < GeneratingEventArgs > Generating { get ; set ; } = new ( ) ;
132133
134+ /// <summary>
135+ /// Invoked before grenade explosion effect is spawned.
136+ /// </summary>
137+ public static Event < SpawningGrenadeEffectEventArgs > SpawningGrenadeEffect { get ; set ; } = new ( ) ;
138+
133139 /// <summary>
134140 /// Called before placing a decal.
135141 /// </summary>
@@ -260,5 +266,21 @@ public static class Map
260266 /// </summary>
261267 /// <param name="ev">The <see cref="GeneratingEventArgs"/> instnace.</param>
262268 public static void OnGenerating ( GeneratingEventArgs ev ) => Generating . InvokeSafely ( ev ) ;
269+
270+ /// <summary>
271+ /// Called before grenade explosion effect is spawned.
272+ /// </summary>
273+ /// <param name="ev">The <see cref="LabApi.Events.Arguments.ServerEvents.ProjectileExplodingEventArgs"/> instance.</param>
274+ public static void OnSpawningGrenadeEffect ( LabApi . Events . Arguments . ServerEvents . ProjectileExplodingEventArgs ev )
275+ {
276+ if ( ! SpawningGrenadeEffect . Patched )
277+ return ;
278+
279+ SpawningGrenadeEffectEventArgs exiledEv = new ( Pickup . Get < TimeGrenadeProjectile > ( ev . TimedGrenade . Base ) , true ) ;
280+ SpawningGrenadeEffect . InvokeSafely ( exiledEv ) ;
281+
282+ ev . Position = exiledEv . Position ;
283+ ev . IsAllowed = exiledEv . IsAllowed ;
284+ }
263285 }
264286}
0 commit comments