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); } }
/// <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);