public static bool Prefix(Scp106PlayerScript __instance)
        {
            try
            {
                if (!__instance._interactRateLimit.CanExecute(true))
                {
                    return(false);
                }
                if (!__instance.GetComponent <FallDamage>().isGrounded)
                {
                    return(false);
                }

                bool allow = true;

                Events.InvokeScp106Teleport(__instance.gameObject, __instance.portalPosition, ref allow);

                if (!allow)
                {
                    return(false);
                }

                if (__instance.iAm106 && __instance.portalPosition != Vector3.zero && !__instance.goingViaThePortal)
                {
                    Timing.RunCoroutine(__instance._DoTeleportAnimation(), Segment.Update);
                }
                return(true);
            }
            catch (Exception e)
            {
                Log.Error($"SCP106Portal Error: {e}");
                return(true);
            }
        }
예제 #2
0
        private static bool Prefix(Scp106PlayerScript __instance)
        {
            if (!__instance._interactRateLimit.CanExecute(false) || !__instance.GetComponent <FallDamage>().isGrounded)
            {
                return(false);
            }

            var ev = new TeleportingEventArgs(API.Features.Player.Get(__instance.gameObject), __instance.portalPosition);

            Scp106.OnTeleporting(ev);

            __instance.portalPosition = ev.PortalPosition;

            if (!ev.IsAllowed)
            {
                return(false);
            }

            if (__instance.iAm106 && __instance.portalPosition != Vector3.zero && !__instance.goingViaThePortal)
            {
                Timing.RunCoroutine(__instance._DoTeleportAnimation(), Segment.Update);
            }

            return(true);
        }