コード例 #1
0
        private static bool Prefix(AmmoSearchCompletor __instance)
        {
            try
            {
                var ev = new PickingUpAmmoEventArgs(Player.Get(__instance.Hub), __instance.TargetPickup);

                Handlers.Player.OnPickingUpAmmo(ev);

                // Allow future pick up of this ammo
                if (!ev.IsAllowed)
                {
                    __instance.TargetPickup.InUse = false;
                }

                return(ev.IsAllowed);
            }
            catch (Exception exception)
            {
                Log.Error($"{typeof(PickingUpAmmo).FullName}\n{exception}");

                return(true);
            }
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: babyboucher/EXILED
 /// <summary>
 /// Called before a player picks up ammo.
 /// </summary>
 /// <param name="ev">The <see cref="PickingUpAmmoEventArgs"/> instance.</param>
 public static void OnPickingUpAmmo(PickingUpAmmoEventArgs ev) => PickingUpAmmo.InvokeSafely(ev);