Ejemplo n.º 1
0
        private static bool ProcessDamage(AttackerDamageHandler __instance, ReferenceHub ply)
        {
            try
            {
                var curClass = ply.characterClassManager.CurClass;
                if (__instance.CheckSpawnProtection(__instance.Attacker.Hub, ply))
                {
                    __instance.Damage = 0f;
                    return(false);
                }
                if (ply.networkIdentity.netId == __instance.Attacker.NetId || __instance.ForceFullFriendlyFire)
                {
                    if (!__instance.AllowSelfDamage && !__instance.ForceFullFriendlyFire)
                    {
                        __instance.Damage = 0f;
                        return(false);
                    }
                    __instance.IsSuicide = true;
                }
                else if (!HitboxIdentity.CheckFriendlyFire(__instance.Attacker.Hub, ply))
                {
                    __instance.Damage        *= AttackerDamageHandler._ffMultiplier;
                    __instance.IsFriendlyFire = true;
                }

                return(false);
            }
            catch (Exception ex)
            {
                Logger.Get.Error($"Synapse-FF: ProcessDamage failed!!\n{ex}");
                return(true);
            }
        }
Ejemplo n.º 2
0
        private static bool Damage(PlayableScps.Scp096 __instance, PlayerStatsSystem.DamageHandlerBase handler)
        {
            try
            {
                AttackerDamageHandler attackerDamageHandler = handler as AttackerDamageHandler;
                if (attackerDamageHandler == null || attackerDamageHandler.Attacker.Hub == null || !__instance.CanEnrage)
                {
                    return(false);
                }

                var player = attackerDamageHandler.Attacker.Hub.GetPlayer();

                if (player.Invisible || Server.Get.Configs.synapseConfiguration.CantRage096.Contains(player.RoleID))
                {
                    return(false);
                }

                if (player.RealTeam == Team.SCP && !Server.Get.Configs.synapseConfiguration.ScpTrigger096)
                {
                    return(false);
                }

                Server.Get.Events.Scp.Scp096.InvokeScpTargetEvent(player, __instance.GetPlayer(), __instance.PlayerState, out var allow);

                if (allow)
                {
                    __instance.AddTarget(attackerDamageHandler.Attacker.Hub.gameObject);
                    __instance.Windup(false);
                }
                return(allow);
            }
            catch (Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AddTargetEvent failed!!\n{e}");
                return(true);
            }
        }