Exemplo n.º 1
0
        internal void InvokeTantrum(Player player, TantrumEnvironmentalHazard trantrum, ref bool allow)
        {
            PlayerWalkOnTantrumEventArgs ev = new PlayerWalkOnTantrumEventArgs()
            {
                SlowDown = allow,
                Player   = player,
                Tantrum  = trantrum
            };

            PlayerWalkOnTantrumEvent?.Invoke(ev);

            allow = ev.SlowDown;
        }
Exemplo n.º 2
0
        private static bool DistanceChanged(TantrumEnvironmentalHazard __instance, ReferenceHub player)
        {
            try
            {
                if (player == null || __instance.DisableEffect || __instance._correctPosition == null)
                {
                    return(false);
                }

                var synapseplayer = player.GetPlayer();

                if (Vector3.Distance(player.transform.position, __instance._correctPosition.position) > __instance.DistanceToBeAffected)
                {
                    return(false);
                }

                var allow = true;

                if ((__instance.SCPImmune && synapseplayer.Team == (int)Team.SCP) || !SynapseExtensions.CanHarmScp(synapseplayer, false) || synapseplayer.GodMode)
                {
                    allow = false;
                }

                Synapse.Api.Events.EventHandler.Get.Player.InvokeTantrum(synapseplayer, __instance, ref allow);

                if (allow)
                {
                    Synapse.Api.Logger.Get.Debug("ALLOW TANTRUM");
                    synapseplayer.PlayerEffectsController.EnableEffect <CustomPlayerEffects.Stained>(2f, false);
                }

                return(false);
            }
            catch (Exception ex)
            {
                Synapse.Api.Logger.Get.Error("Synapse-Event: PlayerWalkOnSinkholeEvent failed!!\n" + ex);
                return(true);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WalkingOnTantrumEventArgs"/> class.
 /// </summary>
 /// <param name="player"><inheritdoc cref="Player"/></param>
 /// <param name="tantrum"><inheritdoc cref="Tantrum"/></param>
 /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
 public WalkingOnTantrumEventArgs(Player player, TantrumEnvironmentalHazard tantrum, bool isAllowed = true)
 {
     Player    = player;
     Tantrum   = tantrum;
     IsAllowed = isAllowed;
 }