Ejemplo n.º 1
0
 // Token: 0x060051F8 RID: 20984 RVA: 0x001C0CB8 File Offset: 0x001BF0B8
 public static void TeleportToOrientation(VRC_PlayerApi player, Vector3 teleportPos, Quaternion teleportRot, VRC_SceneDescriptor.SpawnOrientation teleportOrientation)
 {
     if (player != null)
     {
         player.GetComponent <SyncPhysics>().DiscontinuityHint = true;
         LocomotionInputController component = player.GetComponent <LocomotionInputController>();
         if (component != null)
         {
             component.Teleport(teleportPos, teleportRot, teleportOrientation);
         }
         else
         {
             VRC.Network.RPC(player.GetComponent <VRC.Player>(), player.gameObject, "Teleport", new object[]
             {
                 teleportPos,
                 teleportRot,
                 teleportOrientation
             });
         }
     }
     else
     {
         Debug.LogError("Attempted to teleport a null player!");
     }
 }
Ejemplo n.º 2
0
    private void InternalExitStation(VRC.Player player)
    {
        if (this.Occupant == null || player == null || player != this._occupant)
        {
            return;
        }
        VRC_StationInternal.FlagDiscontinuity(player);
        StationUseExit component = base.GetComponent <StationUseExit>();

        if (component != null)
        {
            UnityEngine.Object.Destroy(component);
        }
        this.Occupant = null;
        if (this.animatorController != null || this.isSeated)
        {
            this.DetachAnimatorControllerFrom(player);
            if (player.isLocal)
            {
                VRCTrackingManager.UseAvatarStationViewPoint(false);
                LocomotionInputController component2 = player.GetComponent <LocomotionInputController>();
                if (component2 != null)
                {
                    component2.immobilize = false;
                }
                VRCMotionState component3 = player.GetComponent <VRCMotionState>();
                if (component3 != null)
                {
                    component3.IsSeated  = false;
                    component3.InVehicle = false;
                }
            }
        }
        if (this.stationControls != null)
        {
            this.stationControls.controllingPlayer = null;
        }
        Collider component4 = player.GetComponent <Collider>();

        if (component4 != null)
        {
            component4.enabled = true;
        }
        this.DetachInputControllerFrom(player.gameObject);
        this.ReleasePlayerTransform(player.gameObject);
        player.currentStation = null;
        if (TutorialManager.Instance != null && player.isLocal && this.isImmobilized)
        {
            TutorialManager.Instance.DeactivateObjectLabel(null);
            TutorialManager.Instance.DeactivateControllerLabel(ControllerHand.Left, ControllerInputUI.TrackpadTop);
        }
        if (player.isLocal)
        {
            VRCTrackingManager.RestoreLevel();
        }
        VRC_StationInternal.RemoveActiveStation(this);
        base.SendMessage("OnStationExited", SendMessageOptions.DontRequireReceiver);
    }
Ejemplo n.º 3
0
        public static void UpdatePlayerSpeed()
        {
            if (VRCPlayer.field_Internal_Static_VRCPlayer_0 == null)
            {
                return;
            }
            LocomotionInputController componentInChildren = PlayerWrapper.GetCurrentPlayer().GetComponentInChildren <LocomotionInputController>();

            if (componentInChildren != null)
            {
                componentInChildren.runSpeed    = walkSpeed;
                componentInChildren.walkSpeed   = walkSpeed;
                componentInChildren.strafeSpeed = walkSpeed;
            }
        }
Ejemplo n.º 4
0
        private void SetLocomotion()
        {
            if (RoomManagerBase.field_Internal_Static_ApiWorld_0 == null ||
                RoomManagerBase.field_Internal_Static_ApiWorldInstance_0 == null)
            {
                return;
            }

            if (!worldAllowed)
            {
                currentlyRunning = false;
            }

            LocomotionInputController locomotion = Utilities.GetLocalVRCPlayer()?.GetComponent <LocomotionInputController>();

            if (locomotion == null)
            {
                return;
            }

            // Grab current settings as some worlds change locomotion with triggers in different parts of the world
            // also means we just went from not running to running
            if (currentlyRunning)
            {
                grabbedWorldSettings = true;
                walkSpeed            = locomotion.walkSpeed;
                runSpeed             = locomotion.runSpeed;
                strafeSpeed          = locomotion.strafeSpeed;
            }

            // to stop being unable to move randomly...
            if (!grabbedWorldSettings)
            {
                return;
            }

            float multiplier = activeSettings.Enabled && currentlyRunning ? activeSettings.SpeedMultiplier : 1f;

            locomotion.walkSpeed   = walkSpeed * multiplier;
            locomotion.runSpeed    = runSpeed * multiplier;
            locomotion.strafeSpeed = strafeSpeed * multiplier;
        }
    // Token: 0x060051AB RID: 20907 RVA: 0x001BFD60 File Offset: 0x001BE160
    public void Initialize()
    {
        LocomotionInputController component = base.gameObject.GetComponent <GamelikeInputController>();

        if (component != null)
        {
            UnityEngine.Object.Destroy(component);
        }
        component = base.gameObject.GetComponent <BlinkInputController>();
        if (component != null)
        {
            UnityEngine.Object.Destroy(component);
        }
        component = base.gameObject.GetComponent <ThirdPersonTeleportInputController>();
        if (component != null)
        {
            UnityEngine.Object.Destroy(component);
        }
        if (this.mInputStateControllerStack.Count == 1)
        {
            this.mInputStateControllerStack.Clear();
        }
        VRCInputManager.LocomotionMethod locomotionMethod = VRCInputManager.locomotionMethod;
        if (locomotionMethod != VRCInputManager.LocomotionMethod.Gamelike)
        {
            if (locomotionMethod != VRCInputManager.LocomotionMethod.Blink)
            {
                if (locomotionMethod == VRCInputManager.LocomotionMethod.ThirdPerson)
                {
                    this.SetBaseInputController("ThirdPersonTeleportInputController");
                }
            }
            else
            {
                this.SetBaseInputController("BlinkInputController");
            }
        }
        else
        {
            this.SetBaseInputController("GamelikeInputController");
        }
    }
Ejemplo n.º 6
0
        public void Update()
        {
            try
            {
                if (VRCPlayer.Instance != null && controller == null)
                {
                    controller = VRCPlayer.Instance.GetComponent <LocomotionInputController>();
                }

                if (Event.current.shift && Input.GetMouseButtonDown(0))
                {
                    TeleportToRaycast();
                }

                AddJumpComponent();
                Flying();
                NoClip();
                SpeedHack();
            }
            catch { }
        }
Ejemplo n.º 7
0
        public override void OnUpdate()
        {
        #if DEBUG
            if (Input.GetKeyDown(KeyCode.O))
            {
                LocomotionInputController locomotion = Utilities.GetLocalVRCPlayer()?.GetComponent <LocomotionInputController>();
                if (locomotion == null)
                {
                    return;
                }

                MelonLogger.Msg("Locomotion Floats:");
                var floatFields = typeof(LocomotionInputController).GetFields()
                                  .Where(f => f.FieldType == typeof(float)).OrderBy(f => f.Name);
                foreach (FieldInfo field in floatFields)
                {
                    MelonLogger.Msg($"\t{field.Name}: {field.GetValue(locomotion)}");
                }
            }
        #endif

            if (!activeSettings.Enabled ||
                !worldAllowed)
            {
                return;
            }

            // Grab last used input method
            useAxisValues = Utilities.GetLastUsedInputMethod() switch
            {
                VRCInputMethod.Keyboard => false,
                VRCInputMethod.Mouse => false,
                _ => true
            };

            // Axis
            if (useAxisValues)
            {
                // Do we want to maybe run? (●'◡'●)
                if (!currentlyRunning)
                {
                    // Clicked
                    if (!Utilities.AxisClicked("Vertical", ref previousAxis, activeSettings.AxisClickThreshold))
                    {
                        return;
                    }

                    // Woow, someone double clicked with a (VR)CONTROLLER!!! ╰(*°▽°*)╯
                    if (Time.time - lastTimeClicked <= activeSettings.DoubleClickTime)
                    {
                        currentlyRunning = true;
                        SetLocomotion();
                        lastTimeClicked = activeSettings.DoubleClickTime * 4f;
                    }
                    else
                    {
                        lastTimeClicked = Time.time;
                    }
                }

                // maybe we should stop?
                else
                {
                    if (Mathf.Abs(Input.GetAxis("Vertical") + Input.GetAxis("Horizontal")) <= activeSettings.AxisDeadZone)
                    {
                        return;
                    }
                    currentlyRunning = false;
                    SetLocomotion();
                }
            }

            // Keyboard
            else
            {
                // Do we want to maybe run? (●'◡'●)
                if (!currentlyRunning &&
                    Utilities.HasDoubleClicked(activeSettings.Forward, ref lastTimeClicked, activeSettings.DoubleClickTime))
                {
                    currentlyRunning = true;
                    SetLocomotion();
                }

                // maybe we should stop?
                else if (currentlyRunning &&
                         !Input.GetKey(activeSettings.Forward) &&
                         !Input.GetKey(activeSettings.Backward) &&
                         !Input.GetKey(activeSettings.Left) &&
                         !Input.GetKey(activeSettings.Right))
                {
                    currentlyRunning = false;
                    SetLocomotion();
                }
            }
        }