// Token: 0x06005AB4 RID: 23220 RVA: 0x001F9958 File Offset: 0x001F7D58 protected override void OnNetworkReady() { base.OnNetworkReady(); if (!VRC_EventHandler.HasEventTrigger(base.gameObject)) { VRC_Trigger orAddComponent = base.gameObject.GetOrAddComponent <VRC_Trigger>(); List <VRC_Trigger.TriggerEvent> triggers = orAddComponent.Triggers; VRC_Trigger.TriggerEvent triggerEvent = new VRC_Trigger.TriggerEvent(); triggerEvent.BroadcastType = VRC_EventHandler.VrcBroadcastType.Local; triggerEvent.TriggerType = VRC_Trigger.TriggerType.OnInteract; triggerEvent.Events = (from evt in this.baseStation.ProvideEvents() where evt.Name == "UseStation" select evt).ToList <VRC_EventHandler.VrcEvent>(); triggers.Add(triggerEvent); } else { VRC_Trigger component = base.GetComponent <VRC_Trigger>(); if (component != null) { foreach (VRC_Trigger.TriggerEvent triggerEvent2 in from t in component.Triggers where t.Events.Any((VRC_EventHandler.VrcEvent e) => e.ParameterString == "UseStation" || e.ParameterString == "ExitStation") select t) { triggerEvent2.BroadcastType = VRC_EventHandler.VrcBroadcastType.Local; } } VRC_UseEvents component2 = base.GetComponent <VRC_UseEvents>(); if (component2 != null) { component2.BroadcastType = VRC_EventHandler.VrcBroadcastType.Local; component2.EventName = "UseStation"; } } Collider component3 = base.gameObject.GetComponent <Collider>(); if (component3 == null) { BoxCollider boxCollider = base.gameObject.AddComponent <BoxCollider>(); boxCollider.isTrigger = true; } VRC_EventHandler component4 = base.GetComponent <VRC_EventHandler>(); if (component4 != null) { VRC_Station component5 = base.GetComponent <VRC_Station>(); using (IEnumerator <VRC_EventHandler.VrcEvent> enumerator2 = component5.ProvideEvents().GetEnumerator()) { while (enumerator2.MoveNext()) { VRC_EventHandler.VrcEvent evt = enumerator2.Current; VRC_StationInternal t = this; if (!component4.Events.Any((VRC_EventHandler.VrcEvent item) => item.Name == evt.Name && item.ParameterObjects != null && item.ParameterObjects.Contains(t.gameObject))) { component4.Events.Add(evt); } } } } }
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); }
private static void OnUseStation(VRC_StationInternal __instance, Player __0) { if (!__0.prop_APIUser_0.IsSelf) { return; } currentStation = __instance; shouldInterrupt = true; }
public override void OnUpdate() { if (currentStation == null) { return; } if (Input.GetKey(KeyCode.Q) && Input.GetKey(KeyCode.E) || useLeft.field_Private_Boolean_0 && useRight.field_Private_Boolean_0) { shouldInterrupt = false; currentStation.ExitStation(Player.prop_Player_0); currentStation = null; } }
// Token: 0x06005989 RID: 22921 RVA: 0x001F1BEC File Offset: 0x001EFFEC public void DoPositionSync(double now, double delta) { if (base.isMine || (double)(Time.time - this.LastUnsettledTime) > VRC.Network.SimulationDelay(base.Owner) * 2.0) { return; } VRC.Player componentInParent = base.gameObject.GetComponentInParent <VRC.Player>(); List <VRC_StationInternal> source = VRC_StationInternal.FindActiveStations(componentInParent); if (this.isPlayer) { if ((from s in source where s.isImmobilized select s).FirstOrDefault <VRC_StationInternal>() != null) { return; } } VRC_StationInternal componentInParent2 = base.gameObject.GetComponentInParent <VRC_StationInternal>(); VRC_StationInternal componentInChildren = base.gameObject.GetComponentInChildren <VRC_StationInternal>(); if (this.hasCamera || base.gameObject.IsVisible() || (componentInParent2 != null && componentInParent2.Occupant != null && componentInParent2.Occupant.isLocal) || (componentInChildren != null && componentInChildren.Occupant != null && componentInChildren.Occupant.isLocal)) { if (SyncPhysics.f__mg2 == null) { SyncPhysics.f__mg2 = new TweenFunctions.TweenFunction <SyncPhysics.PositionEvent>(TweenFunctions.CatMullRomTween <SyncPhysics.PositionEvent>); } this.InterpolateFunction = SyncPhysics.f__mg2; } else { if (SyncPhysics.f__mg3 == null) { SyncPhysics.f__mg3 = new TweenFunctions.TweenFunction <SyncPhysics.PositionEvent>(TweenFunctions.NoTween <SyncPhysics.PositionEvent>); } this.InterpolateFunction = SyncPhysics.f__mg3; } double num = now - VRC.Network.SimulationDelay(base.Owner); SyncPhysics.PositionEvent positionEvent = TweenFunctions.Tween <SyncPhysics.PositionEvent>(this.positionHistory, this.InterpolateFunction, num, VRC.Network.ExpectedInterval, (!this.isPlayer) ? -1 : base.photonView.viewID); if (positionEvent == null && this.positionHistory.Full && this.positionHistory[0].Time > num) { this.positionHistory.Capacity *= 2; } if (positionEvent != null) { this.DoAdjustment(positionEvent); } }
// Token: 0x06005AA3 RID: 23203 RVA: 0x001F9724 File Offset: 0x001F7B24 public static bool ExitAllStations(VRC.Player target) { if (target == null) { return(false); } bool flag = true; List <VRC_StationInternal> list = VRC_StationInternal.FindActiveStations(target); foreach (VRC_StationInternal vrc_StationInternal in list) { vrc_StationInternal.ExitStation(target); flag = (flag && vrc_StationInternal.Occupant != target); } return(flag); }
// Token: 0x060054F4 RID: 21748 RVA: 0x001D4BE4 File Offset: 0x001D2FE4 public void RespawnPlayer(VRCPlayer player) { if (player != null) { this.mPlayer = player.player; VRC_StationInternal.ExitAllStations(this.mPlayer); bool isActiveAndEnabled = VRCUiManager.Instance.isActiveAndEnabled; if (isActiveAndEnabled) { VRCUiManager.Instance.CloseUi(true); } this.mStation = base.GetComponent <VRC_StationInternal>(); if (this.mStation != null) { this.PutPlayerInStation(); } else { Vector3 eulerAngles = base.transform.eulerAngles; eulerAngles.x = (eulerAngles.z = 0f); this.mPlayer.playerApi.TeleportTo(base.transform.position, Quaternion.Euler(eulerAngles)); } } }
public static IEnumerator EnforceAvatarStationLimitsEnumerator(GameObject currentAvatar, System.Action <VRCSDK2.VRC_Station> onFound) { Queue <GameObject> children = new Queue <GameObject>(); children.Enqueue(currentAvatar.gameObject); int station_count = 0; while (children.Count > 0) { GameObject child = children.Dequeue(); if (child == null) { continue; } int childCount = child.transform.childCount; for (int idx = 0; idx < child.transform.childCount; ++idx) { children.Enqueue(child.transform.GetChild(idx).gameObject); } VRCSDK2.VRC_Station[] stations = child.transform.GetComponents <VRCSDK2.VRC_Station>(); if (stations != null && stations.Length > 0) { for (int i = 0; i < stations.Length; i++) { VRCSDK2.VRC_Station station = stations[i]; if (station == null) { continue; } #if VRC_CLIENT VRC_StationInternal station_internal = station.transform.GetComponent <VRC_StationInternal>(); #endif if (station_count < MAX_STATIONS_PER_AVATAR) { bool marked_for_destruction = false; // keep this station, but limit it if (station.disableStationExit) { Debug.LogError("[" + currentAvatar.name + "]==> Stations on avatars cannot disable station exit. Re-enabled."); station.disableStationExit = false; } if (station.stationEnterPlayerLocation != null) { if (Vector3.Distance(station.stationEnterPlayerLocation.position, station.transform.position) > MAX_STATION_LOCATION_DISTANCE) { #if VRC_CLIENT marked_for_destruction = true; Debug.LogError("[" + currentAvatar.name + "]==> Station enter location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station disabled."); #else Debug.LogError("Station enter location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station will be disabled at runtime."); #endif } if (Vector3.Distance(station.stationExitPlayerLocation.position, station.transform.position) > MAX_STATION_LOCATION_DISTANCE) { #if VRC_CLIENT marked_for_destruction = true; Debug.LogError("[" + currentAvatar.name + "]==> Station exit location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station disabled."); #else Debug.LogError("Station exit location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station will be disabled at runtime."); #endif } if (marked_for_destruction) { #if VRC_CLIENT Validation.RemoveComponent(station); if (station_internal != null) { Validation.RemoveComponent(station_internal); } #endif } else { if (onFound != null) { onFound(station); } } } } else { #if VRC_CLIENT Debug.LogError("[" + currentAvatar.name + "]==> Removing station over limit of " + MAX_STATIONS_PER_AVATAR); Validation.RemoveComponent(station); if (station_internal != null) { Validation.RemoveComponent(station_internal); } #else Debug.LogError("Too many stations on avatar(" + currentAvatar.name + "). Maximum allowed=" + MAX_STATIONS_PER_AVATAR + ". Extra stations will be removed at runtime."); #endif } station_count++; } } yield return(null); } }
public static IEnumerator EnforceAvatarStationLimitsEnumerator(GameObject currentAvatar, System.Action <VRC_Station> onFound) { Queue <GameObject> children = new Queue <GameObject>(); children.Enqueue(currentAvatar.gameObject); int stationCount = 0; uint objectsProcessedThisFrame = 0; while (children.Count > 0) { if (Time.frameCount > _enforceAvatarStationsFrameNumber) { _enforceAvatarStationsFrameNumber = Time.frameCount; _enforceAvatarStationsProcessedThisFrame = 0; } if (_enforceAvatarStationsProcessedThisFrame > ENFORCE_STATIONS_GAMEOBJECTS_PER_FRAME) { yield return(null); } Profiler.BeginSample("EnforceAvatarStationLimitsEnumerator"); _enforceAvatarStationsProcessedThisFrame++; GameObject child = children.Dequeue(); if (child == null) { Profiler.EndSample(); continue; } int childCount = child.transform.childCount; for (int idx = 0; idx < childCount; ++idx) { children.Enqueue(child.transform.GetChild(idx).gameObject); } VRC_Station[] stations = child.transform.GetComponents <VRC_Station>(); if (stations != null && stations.Length > 0) { foreach (VRC_Station station in stations) { if (station == null) { Profiler.EndSample(); continue; } #if VRC_CLIENT VRC_StationInternal stationInternal = station.transform.GetComponent <VRC_StationInternal>(); #endif if (stationCount < MAX_STATIONS_PER_AVATAR) { bool markedForDestruction = false; // keep this station, but limit it if (station.disableStationExit) { Debug.LogError("[" + currentAvatar.name + "]==> Stations on avatars cannot disable station exit. Re-enabled."); station.disableStationExit = false; } if (station.stationEnterPlayerLocation != null) { if (Vector3.Distance(station.stationEnterPlayerLocation.position, station.transform.position) > MAX_STATION_LOCATION_DISTANCE) { #if VRC_CLIENT markedForDestruction = true; Debug.LogError("[" + currentAvatar.name + "]==> Station enter location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station disabled."); #else Debug.LogError("Station enter location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station will be disabled at runtime."); #endif } if (Vector3.Distance(station.stationExitPlayerLocation.position, station.transform.position) > MAX_STATION_LOCATION_DISTANCE) { #if VRC_CLIENT markedForDestruction = true; Debug.LogError("[" + currentAvatar.name + "]==> Station exit location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station disabled."); #else Debug.LogError("Station exit location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station will be disabled at runtime."); #endif } if (markedForDestruction) { #if VRC_CLIENT ValidationUtils.RemoveComponent(station); if (stationInternal != null) { ValidationUtils.RemoveComponent(stationInternal); } #endif } else { if (onFound != null) { onFound(station); } } } } else { #if VRC_CLIENT Debug.LogError("[" + currentAvatar.name + "]==> Removing station over limit of " + MAX_STATIONS_PER_AVATAR); ValidationUtils.RemoveComponent(station); if (stationInternal != null) { ValidationUtils.RemoveComponent(stationInternal); } #else Debug.LogError("Too many stations on avatar(" + currentAvatar.name + "). Maximum allowed=" + MAX_STATIONS_PER_AVATAR + ". Extra stations will be removed at runtime."); #endif } stationCount++; } } Profiler.EndSample(); if (objectsProcessedThisFrame < ENFORCE_STATIONS_GAMEOBJECTS_PER_FRAME) { continue; } objectsProcessedThisFrame = 0; yield return(null); } }
// Token: 0x060062A4 RID: 25252 RVA: 0x0022F1A8 File Offset: 0x0022D5A8 protected VRCUiCursor.CursorOver[] CheckCursorTouch(VRCUiCursor.CursorRaycast target) { if (VRCPlayer.Instance == null) { return(new VRCUiCursor.CursorOver[0]); } VRCHandGrasper handGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left); if (handGrasper != null && handGrasper.IsHoldingObject()) { return(new VRCUiCursor.CursorOver[0]); } int num = -1; Vector3 point = Vector3.zero; Vector3 normal = Vector3.zero; float num2 = float.PositiveInfinity; VRC_Interactable[] array = null; VRC_Pickup vrc_Pickup = null; VRC_PlayerApi apiPlayer = VRCPlayer.Instance.apiPlayer; Collider[] array2 = Physics.OverlapSphere(target.touch.position, target.touch.radius, VRCUiCursorManager.GetCurrentInteractiveLayers()); for (int i = 0; i < array2.Length; i++) { bool flag = false; Vector3 vector = PhysicsUtil.ClosestPointOnCollider(array2[i], target.touch.position, ref flag); Vector3 vector2 = vector - target.touch.position; float dist = (!flag) ? vector2.magnitude : 0f; if (dist <= target.touch.radius) { VRC_Interactable[] array3 = (from inter in array2[i].GetComponents <VRC_Interactable>() where inter.IsInteractiveForPlayer(apiPlayer) select inter).ToArray <VRC_Interactable>(); VRC_Pickup vrc_Pickup2 = array2[i].GetComponent <VRC_Pickup>(); if (array3.Length != 0 || !(vrc_Pickup2 == null)) { if (array3 != null && (array3.Length == 0 || array3.All((VRC_Interactable x) => dist > x.proximity))) { array3 = null; } VRC_StationInternal component = array2[i].GetComponent <VRC_StationInternal>(); if (array3 != null && component != null && component.Occupant == VRCPlayer.Instance.gameObject) { array3 = null; } if (vrc_Pickup2 != null && (!vrc_Pickup2.pickupable || !VRCPlayer.Instance.canPickupObjects || (vrc_Pickup2.IsHeld && vrc_Pickup2.DisallowTheft && vrc_Pickup2.currentPlayer != apiPlayer))) { vrc_Pickup2 = null; } if (vrc_Pickup2 != null && vrc_Pickup2.currentlyHeldBy != null && dist > VRCHandGrasper.LerpToHandMinDistance) { vrc_Pickup2 = null; } if ((vrc_Pickup2 != null && vrc_Pickup == null) || dist <= num2) { if (!(vrc_Pickup2 == null) || (array3 != null && array3.Length != 0)) { num = i; num2 = dist; point = vector; normal = vector2.normalized; array = array3; vrc_Pickup = vrc_Pickup2; } } } } } if (num < 0) { return(new VRCUiCursor.CursorOver[0]); } target.hitInfo.distance = num2; target.hitInfo.normal = normal; target.hitInfo.point = point; target.pickup = vrc_Pickup; target.interactable = array; if (vrc_Pickup != null && array != null) { target.over = new VRCUiCursor.CursorOver[] { VRCUiCursor.CursorOver.Pickup, VRCUiCursor.CursorOver.Interactable }; } else if (array != null) { target.over = new VRCUiCursor.CursorOver[] { VRCUiCursor.CursorOver.Interactable }; } else if (vrc_Pickup != null) { target.over = new VRCUiCursor.CursorOver[] { VRCUiCursor.CursorOver.Pickup }; } else { target.over = new VRCUiCursor.CursorOver[0]; } return(target.over); }
// Token: 0x060062A5 RID: 25253 RVA: 0x0022F56C File Offset: 0x0022D96C protected VRCUiCursor.CursorOver[] CastCursorRay(VRCUiCursor.CursorRaycast target) { target.over = new VRCUiCursor.CursorOver[0]; List <VRCUiCursor.CursorOver> list = new List <VRCUiCursor.CursorOver>(); int layerMask = VRCUiCursorManager.GetCurrentInteractiveLayers(); Ray ray = target.ray; float num = 0f; float num2 = 100f; while (num2 > 0f && list.Count == 0) { ray.origin += ray.direction * num; num2 -= num; RaycastHit hitInfo; if (!Physics.Raycast(ray, out hitInfo, num2, layerMask)) { target.hitInfo.distance = 10f; target.hitInfo.point = target.ray.origin + target.ray.direction * 10f; break; } num = hitInfo.distance + 0.01f; GameObject gameObject = hitInfo.collider.gameObject; VRC_UiShape component = gameObject.GetComponent <VRC_UiShape>(); if (component != null) { target.hitInfo = hitInfo; target.uiShape = component; list.Add(VRCUiCursor.CursorOver.Ui); } else if (gameObject.GetComponentInParent <VRCPlayer>() != null) { if (this.uiMenuLayer < 0) { this.uiMenuLayer = LayerMask.NameToLayer("UiMenu"); } if (gameObject.layer == this.uiMenuLayer) { target.hitInfo = hitInfo; target.player = gameObject.GetComponentInParent <VRCPlayer>(); list.Add(VRCUiCursor.CursorOver.Player); } } if (VRCPlayer.Instance != null) { VRCHandGrasper handGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left); if (!(handGrasper != null) || !handGrasper.IsHoldingObject()) { float num3 = 0f; if (target.extraReach) { num3 = VRCTrackingManager.GetRayReach(target.ray); } VRC_PlayerApi apiPlayer = VRCPlayer.Instance.apiPlayer; float range = hitInfo.distance - num3; VRC_Interactable[] array = (from inter in gameObject.GetComponents <VRC_Interactable>() where range <= inter.proximity && inter.IsInteractiveForPlayer(apiPlayer) select inter).ToArray <VRC_Interactable>(); VRC_Pickup vrc_Pickup = gameObject.GetComponent <VRC_Pickup>(); if (array.Length == 0) { array = null; } VRC_StationInternal component2 = gameObject.GetComponent <VRC_StationInternal>(); if (array != null && component2 != null && component2.Occupant == VRCPlayer.Instance.gameObject) { array = null; } if (vrc_Pickup != null && (!vrc_Pickup.pickupable || !VRCPlayer.Instance.canPickupObjects || (vrc_Pickup.IsHeld && vrc_Pickup.DisallowTheft && vrc_Pickup.currentPlayer != apiPlayer))) { vrc_Pickup = null; } if (array != null && vrc_Pickup != null) { target.hitInfo = hitInfo; target.interactable = array; target.pickup = vrc_Pickup; list.Add(VRCUiCursor.CursorOver.Pickup); list.Add(VRCUiCursor.CursorOver.Interactable); } else if (array != null) { target.hitInfo = hitInfo; target.interactable = array; list.Add(VRCUiCursor.CursorOver.Interactable); VRC_WebPanel component3 = gameObject.GetComponent <VRC_WebPanel>(); if (component3 != null && component3.interactive) { target.hitInfo = hitInfo; target.webPanel = component3.GetComponent <WebPanelInternal>(); list.Add(VRCUiCursor.CursorOver.Web); } } else if (vrc_Pickup != null && range <= 0f) { target.hitInfo = hitInfo; target.pickup = vrc_Pickup; list.Add(VRCUiCursor.CursorOver.Pickup); } if (list.Count == 0) { if (Vector3.Dot(Vector3.up, hitInfo.normal) > 0.7f) { target.hitInfo = hitInfo; list.Add(VRCUiCursor.CursorOver.Floor); } else { target.hitInfo = hitInfo; list.Add(VRCUiCursor.CursorOver.Other); } } } } else { VRC_WebPanel component4 = gameObject.GetComponent <VRC_WebPanel>(); if (component4 != null && component4.interactive) { target.hitInfo = hitInfo; target.webPanel = component4.GetComponent <WebPanelInternal>(); list.Add(VRCUiCursor.CursorOver.Web); } } } target.over = list.ToArray(); return(target.over); }
private void InternalUseStation(VRC.Player player) { bool flag = false; if (player == null || (this.Occupant != null && this.Occupant != player) || player == this.Occupant) { return; } List <VRC_StationInternal> source = VRC_StationInternal.FindActiveStations(player); if (source.FirstOrDefault((VRC_StationInternal s) => s != this) != null) { if (!this.canUseStationFromStation) { return; } if (!VRC_StationInternal.ExitAllStations(player)) { return; } flag = true; } else { VRC_StationInternal.ExitAllStations(player); } if (this.Occupant != null) { return; } VRC_StationInternal.FlagDiscontinuity(player); this.Occupant = player; if (flag) { this._occupant = null; return; } if (VRC_EventHandler.HasEventTrigger(base.gameObject)) { this.AddUseExit(player); } if (this.stationControls != null) { this.stationControls.controllingPlayer = player.GetComponent <VRC_PlayerApi>(); } Vector3 position = Vector3.zero; Quaternion rhs = Quaternion.identity; if (player.isLocal) { VRCPlayer component = player.GetComponent <VRCPlayer>(); component.AlignTrackingToPlayer(); Transform trackingTransform = VRCTrackingManager.GetTrackingTransform(); Vector3 position2 = trackingTransform.position; Quaternion rotation = trackingTransform.rotation; position = player.transform.InverseTransformPoint(trackingTransform.position); rhs = Quaternion.Inverse(player.transform.rotation) * rotation; } if (this.isSeated) { this.ApplySeatedAnimation(player); } this.SetEnterPlayerTransform(player.gameObject); player.currentStation = this; if (player.isLocal) { VRCTrackingManager.SetTrackingWorldOrigin(player.transform.TransformPoint(position), player.transform.rotation * rhs); if (this.isSeated) { VRCTrackingManager.UseAvatarStationViewPoint(true); } if (this.stationEnterPlayerLocation != null) { this.stationEnterInitialRotation = this.stationEnterPlayerLocation.rotation; } else { this.stationEnterInitialRotation = base.transform.rotation; } this.trackingOriginDeltaPosition = VRCTrackingManager.GetTrackingWorldOrigin() - player.transform.position; this.trackingOriginDeltaRotation = Quaternion.FromToRotation(player.transform.TransformDirection(Vector3.forward), VRCTrackingManager.GetTrackingTransform().TransformDirection(Vector3.forward)); player.GetComponent <LocomotionInputController>().immobilize = this.isImmobilized; player.GetComponent <VRCMotionState>().IsSeated = this.isSeated; player.GetComponent <VRCMotionState>().InVehicle = this.inVehicle; } if (this.isImmobilized) { Collider component2 = player.GetComponent <Collider>(); if (component2 != null) { component2.enabled = false; } if (player.isLocal) { this.AttachInputControllerTo(player, "ImmobileInputController"); } } if (this.controlsObject != null) { VRC.Network.SetOwner(player, this.controlsObject.gameObject, VRC.Network.OwnershipModificationType.Request, false); } if (TutorialManager.Instance != null && player.isLocal && this.isImmobilized && !this.disableStationExit) { base.StartCoroutine(this.ShowGetUpInstructions()); } VRC_StationInternal.AddActiveStation(this); base.SendMessage("OnStationEntered", SendMessageOptions.DontRequireReceiver); }
// Token: 0x06005AA5 RID: 23205 RVA: 0x001F97BA File Offset: 0x001F7BBA public static void RemoveActiveStation(VRC_StationInternal station) { VRC_StationInternal.activeStations.Remove(station); }
// Token: 0x06005AA4 RID: 23204 RVA: 0x001F97AC File Offset: 0x001F7BAC public static void AddActiveStation(VRC_StationInternal station) { VRC_StationInternal.activeStations.Add(station); }
public static void EnforceAvatarStationLimits(GameObject currentAvatar) { using (_enforceAvatarStationLimitsProfilerMarker.Auto()) { int stationCount = 0; foreach (VRC.SDKBase.VRCStation station in currentAvatar.gameObject.GetComponentsInChildren <VRC.SDKBase.VRCStation>(true)) { if (station == null) { continue; } #if VRC_CLIENT VRC_StationInternal stationInternal = station.transform.GetComponent <VRC_StationInternal>(); #endif if (stationCount < MAX_STATIONS_PER_AVATAR) { #if VRC_CLIENT bool markedForDestruction = false; #endif // keep this station, but limit it if (station.disableStationExit) { Debug.LogError("[" + currentAvatar.name + "]==> Stations on avatars cannot disable station exit. Re-enabled."); station.disableStationExit = false; } if (station.stationEnterPlayerLocation != null) { if (Vector3.Distance(station.stationEnterPlayerLocation.position, station.transform.position) > MAX_STATION_LOCATION_DISTANCE) { #if VRC_CLIENT markedForDestruction = true; Debug.LogError( "[" + currentAvatar.name + "]==> Station enter location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station disabled."); #else Debug.LogError("Station enter location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station will be disabled at runtime."); #endif } if (Vector3.Distance(station.stationExitPlayerLocation.position, station.transform.position) > MAX_STATION_LOCATION_DISTANCE) { #if VRC_CLIENT markedForDestruction = true; Debug.LogError( "[" + currentAvatar.name + "]==> Station exit location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station disabled."); #else Debug.LogError("Station exit location is too far from station (max dist=" + MAX_STATION_LOCATION_DISTANCE + "). Station will be disabled at runtime."); #endif } #if VRC_CLIENT if (markedForDestruction) { ValidationUtils.RemoveComponent(station); if (stationInternal != null) { ValidationUtils.RemoveComponent(stationInternal); } } #endif } } else { #if VRC_CLIENT Debug.LogError("[" + currentAvatar.name + "]==> Removing station over limit of " + MAX_STATIONS_PER_AVATAR); ValidationUtils.RemoveComponent(station); if (stationInternal != null) { ValidationUtils.RemoveComponent(stationInternal); } #else Debug.LogError("Too many stations on avatar(" + currentAvatar.name + "). Maximum allowed=" + MAX_STATIONS_PER_AVATAR + ". Extra stations will be removed at runtime."); #endif } stationCount++; } } }