示例#1
0
        public static bool Prefix(PlayableScps.Scp096 __instance, VisionInformation info)
        {
            PlayableScpsController playableScpsController;
            bool whitelisted = info.Source.GetComponent <AdditionalPlayerAbilities>() != null && info.Source.GetComponent <AdditionalPlayerAbilities>().scp096whitelisted;

            Exiled.API.Features.Log.Info("Патчим агр скромника, результат: " + whitelisted);
            if (!info.Looking || !info.RaycastHit || !info.RaycastResult.transform.gameObject.TryGetComponent <PlayableScpsController>(out playableScpsController) || playableScpsController.CurrentScp == null || playableScpsController.CurrentScp != __instance || whitelisted)
            {
                return(false);
            }
            float delay = (1f - info.DotProduct) / 0.25f * (Vector3.Distance(info.Source.transform.position, info.Target.transform.position) * 0.1f);

            if (!__instance.Calming)
            {
                __instance.AddTarget(info.Source);
            }
            if (__instance.CanEnrage && info.Source != null)
            {
                __instance.PreWindup(delay);
                if (NetworkServer.active)
                {
                    NetworkServer.SendToAll <Scp096TriggerMessage>(new Scp096TriggerMessage(info.Target, info.Source), 0);
                }
            }

            return(false);
        }
示例#2
0
        private static bool Prefix(PlayableScps.Scp096 __instance)
        {
            try
            {
                if (__instance._flash.Enabled)
                {
                    return(false);
                }
                var vector = __instance.Hub.transform.TransformPoint(PlayableScps.Scp096._headOffset);
                foreach (var player in Server.Get.Players)
                {
                    var characterClassManager = player.ClassManager;
                    if (characterClassManager.CurClass != RoleType.Spectator && !(player.Hub == __instance.Hub) && !characterClassManager.IsAnyScp() && Vector3.Dot((player.CameraReference.position - vector).normalized, __instance.Hub.PlayerCameraReference.forward) >= 0.1f)
                    {
                        var visionInformation = VisionInformation.GetVisionInformation(player.Hub, vector, -0.1f, 60f, true, true, __instance.Hub.localCurrentRoomEffects);
                        if (visionInformation.IsLooking)
                        {
                            float delay = visionInformation.LookingAmount / 0.25f * (visionInformation.Distance * 0.1f);
                            if (!__instance.Calming)
                            {
                                if (player.Invisible || Server.Get.Configs.SynapseConfiguration.CantRage096.Contains(player.RoleID))
                                {
                                    continue;
                                }

                                if (player.RealTeam == Team.SCP && !Server.Get.Configs.SynapseConfiguration.ScpTrigger096)
                                {
                                    continue;
                                }

                                Server.Get.Events.Scp.Scp096.InvokeScpTargetEvent(player, __instance.GetPlayer(), __instance.PlayerState, out var allow);
                                __instance.AddTarget(player.gameObject);
                                if (!allow)
                                {
                                    continue;
                                }
                            }
                            if (__instance.CanEnrage && player.gameObject != null)
                            {
                                __instance.PreWindup(delay);
                            }
                        }
                    }
                }
                return(false);
            }
            catch (Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AddTargetEvent failed!!\n{e}\nStackTrace:\n{e.StackTrace}");
                return(true);
            }
        }