Exemplo n.º 1
0
        private static bool Prefix(WeaponManager __instance, bool isBlood, ref int type, ref Vector3 pos, ref Quaternion rot)
        {
            if (isBlood)
            {
                var ev = new PlacingBloodEventArgs(
                    API.Features.Player.Get(__instance.gameObject),
                    pos,
                    __instance._hub.characterClassManager.Classes.SafeGet(__instance._hub.characterClassManager.CurClass).bloodType,
                    1);

                pos = ev.Position;
                __instance._hub.characterClassManager.Classes.SafeGet(__instance._hub.characterClassManager.CurClass).bloodType = ev.Type;

                Map.OnPlacingBlood(ev);

                return(ev.IsAllowed && Events.Instance.Config.CanSpawnBlood);
            }
            else
            {
                var ev = new PlacingDecalEventArgs(API.Features.Player.Get(__instance.gameObject), pos, rot, type);

                Map.OnPlacingDecal(ev);

                pos  = ev.Position;
                rot  = ev.Rotation;
                type = ev.Type;

                return(ev.IsAllowed);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Called before placing a decal.
 /// </summary>
 /// <param name="ev">The <see cref="PlacingDecalEventArgs"/> instance.</param>
 public static void OnPlacingDecal(PlacingDecalEventArgs ev) => PlacingDecal.InvokeSafely(ev);