Exemple #1
0
        public static bool Prefix(Scp173PlayerScript __instance)
        {
            Plugin.Singleton.Functions.CustomBlinkSequence(__instance);

            if (!__instance.iAm173 || (!__instance.isLocalPlayer && !Mirror.NetworkServer.active))
            {
                return(false);
            }

            __instance.AllowMove = true;
            Plugin.Singleton.SomeoneIsLooking = false;

            foreach (Player player in Player.List)
            {
                Scp173PlayerScript playerScript = player.ReferenceHub.characterClassManager.Scp173;

                if (!playerScript.SameClass &&                         // Is not an 173 (?)
                    (player.Role != RoleType.Tutorial ||               // Is not Tutorial
                     Events.Instance.Config.CanTutorialBlockScp173) && // Is Tutorial but can block
                    playerScript.LookFor173(__instance.gameObject, true) && // Check if player is looking at 173
                    __instance.LookFor173(player.GameObject, false))   // ????
                {
                    __instance.AllowMove = false;
                    Plugin.Singleton.SomeoneIsLooking = true;
                    break;
                }
            }

            if (!Plugin.Singleton.SomeoneIsLooking)
            {
                Plugin.Singleton.Functions.SubtractTime(UnityEngine.Time.fixedDeltaTime * Plugin.Singleton.Config.DecreaseRate);
            }

            return(false);
        }
        public static bool Prefix(Scp173PlayerScript __instance)
        {
            BlinkCustomMethod.CustomBlinkingSequence(__instance);

            if (!__instance.iAm173 || (!__instance.isLocalPlayer && !Mirror.NetworkServer.active))
            {
                return(false);
            }
            if (!BlinkCustomMethod.someoneLooking)
            {
                BlinkCustomMethod.reworkSubstractTime -= Time.fixedDeltaTime * BlinkConfigs.decreaseRate;
                if (BlinkCustomMethod.reworkSubstractTime < 0f)
                {
                    BlinkCustomMethod.reworkSubstractTime = 0f;
                }
            }
            __instance._allowMove            = true;
            BlinkCustomMethod.someoneLooking = false;
            foreach (GameObject gameObject in PlayerManager.players)
            {
                Scp173PlayerScript component = gameObject.GetComponent <Scp173PlayerScript>();
                if (!component.SameClass &&
                    component.GetComponent <CharacterClassManager>().CurClass != RoleType.Tutorial &&
                    component.LookFor173(__instance.gameObject, true) &&
                    __instance.LookFor173(component.gameObject, false))
                {
                    __instance._allowMove            = false;
                    BlinkCustomMethod.someoneLooking = true;
                    break;
                }
            }
            return(false);
        }
Exemple #3
0
        private static void Prefix(Scp173PlayerScript __instance)
        {
            if (Scp173PlayerScript._remainingTime - Time.fixedDeltaTime < 0f)
            {
                var triggers = ListPool <Player> .Shared.Rent();

                foreach (var player in Player.List)
                {
                    if (player.Team != Team.SCP && player.Team != Team.RIP)
                    {
                        Scp173PlayerScript playerScript = player.ReferenceHub.characterClassManager.Scp173;

                        if (playerScript.LookFor173(__instance.gameObject, true))
                        {
                            triggers.Add(player);
                        }
                    }
                }

                if (triggers.Count > 0)
                {
                    Handlers.Scp173.OnBlinking(new BlinkingEventArgs(Player.Get(__instance.gameObject), triggers));
                }

                ListPool <Player> .Shared.Return(triggers);
            }
        }
 private void FixedUpdate()
 {
     this.DoBlinkingSequence();
     if (base.isLocalPlayer && this.iAm173)
     {
         this.allowMove = true;
         foreach (GameObject gameObject in PlayerManager.singleton.players)
         {
             Scp173PlayerScript component = gameObject.GetComponent <Scp173PlayerScript>();
             if (!component.sameClass && component.LookFor173())
             {
                 this.cooldown  = 10;
                 this.allowMove = false;
             }
         }
         this.CheckForInput();
         this.fpc.lookingAtMe = (!this.allowMove && this.cooldown > 0);
         if (this.cooldown >= 0)
         {
             this.cooldown--;
         }
         float num = this.boost_speed.Evaluate(this.ps.GetHealthPercent());
         this.fpc.m_WalkSpeed = num;
         this.fpc.m_RunSpeed  = num;
     }
 }
Exemple #5
0
        private static bool Prefix(Scp173PlayerScript __instance)
        {
            try
            {
                if ((Scp173PlayerScript._remainingTime - Time.fixedDeltaTime) >= 0f)
                {
                    return(true);
                }
                if (!SynapseController.Server.Map.Round.RoundIsActive)
                {
                    return(true);
                }

                __instance.DoBlinkingSequence();
                if (!__instance.iAm173 || (!__instance.isLocalPlayer && !NetworkServer.active))
                {
                    return(false);
                }

                HashSet <Player> players = new HashSet <Player>();

                //Get all players looking at Scp173
                foreach (GameObject gameObject in PlayerManager.players)
                {
                    Scp173PlayerScript component = gameObject.GetComponent <Scp173PlayerScript>();
                    if (!component.SameClass && component.LookFor173(__instance.gameObject, true) && __instance.LookFor173(component.gameObject, false))
                    {
                        players.Add(gameObject.GetPlayer());
                    }
                }

                var scriptHolder = __instance.gameObject.GetPlayer();
                scriptHolder.Scp173Controller.ConfrontingPlayers = players;

                //If someone is confronting Scp173 when blinking
                if (scriptHolder.Scp173Controller.ConfrontingPlayers.Count != 0)
                {
                    Server.Get.Events.Scp.Scp173.InvokeScp173BlinkEvent(scriptHolder);
                }

                __instance.AllowMove = true;

                //Original
                foreach (GameObject gameObject in PlayerManager.players)
                {
                    Scp173PlayerScript component = gameObject.GetComponent <Scp173PlayerScript>();
                    if (!component.SameClass && component.LookFor173(__instance.gameObject, true) && __instance.LookFor173(component.gameObject, false))
                    {
                        __instance.AllowMove = false;
                        break;
                    }
                }
            }
            catch (System.Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp173BlinkEvent(Scp173) failed!!\n{e}\nStackTrace:\n{e.StackTrace}");
            }
            return(false);
        }
Exemple #6
0
        public static bool Prefix(Scp173PlayerScript __instance)
        {
            if (EventPlugin.Scp173PatchDisable)
            {
                return(true);
            }

            try
            {
                __instance.DoBlinkingSequence();

                if (!__instance.iAm173)
                {
                    return(false);
                }

                __instance._allowMove = true;

                foreach (GameObject player in PlayerManager.players)
                {
                    ReferenceHub hub = player.GetPlayer();

                    if (hub.characterClassManager.CurClass == RoleType.Tutorial)
                    {
                        continue;
                    }

                    Scp173PlayerScript component = player.GetComponent <Scp173PlayerScript>();

                    if (!component.SameClass && component.LookFor173(__instance.gameObject, true) && __instance.LookFor173(component.gameObject, false))
                    {
                        __instance._allowMove = false;
                        break;
                    }
                }

                return(false);
            }
            catch (Exception exception)
            {
                Log.Error($"Scp173Patch error: {exception}");
                return(true);
            }
        }
        private static bool Prefix(Scp173PlayerScript __instance)
        {
            try
            {
                __instance.DoBlinkingSequence();

                if (!__instance.iAm173)
                {
                    return(false);
                }

                __instance._allowMove = true;

                foreach (GameObject gameObject in PlayerManager.players)
                {
                    Player player = Player.Get(gameObject);

                    if (player.Role == RoleType.Tutorial)
                    {
                        continue;
                    }

                    Scp173PlayerScript component = player.ReferenceHub.GetComponent <Scp173PlayerScript>();

                    if (!component.SameClass && component.LookFor173(__instance.gameObject, true) && __instance.LookFor173(component.gameObject, false))
                    {
                        __instance._allowMove = false;
                        break;
                    }
                }

                return(false);
            }
            catch (Exception exception)
            {
                Log.Error($"Scp173BeingLooked error: {exception}");
                return(true);
            }
        }