public bool ShouldSyncTo(DynamicOccupant occupantType)
        {
            if (AttachedObject == null)
            {
                DebugLog.ToConsole($"Warning - AttachedObject for sector id:{ObjectId} is null!", MessageType.Warning);
                return(false);
            }

            if (!AttachedObject.gameObject.activeInHierarchy)
            {
                return(false);
            }

            if (occupantType == DynamicOccupant.Ship && Type == Sector.Name.Ship)
            {
                return(false);
            }

            if (AttachedObject.name is "Sector_Shuttle" or "Sector_NomaiShuttleInterior")
            {
                if (QSBSceneManager.CurrentScene == OWScene.SolarSystem)
                {
                    var shuttleController = AttachedObject.gameObject.GetComponentInParent <NomaiShuttleController>();
                    if (shuttleController == null)
                    {
                        DebugLog.ToConsole($"Warning - Expected to find a NomaiShuttleController for {AttachedObject.name}!", MessageType.Warning);
                        return(false);
                    }

                    if (!shuttleController.IsPlayerInside())
                    {
                        return(false);
                    }
                }
                else if (QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse)
                {
                    var shuttleController = QSBWorldSync.GetUnityObjects <EyeShuttleController>().First();
                    if (shuttleController == null)
                    {
                        DebugLog.ToConsole($"Warning - Expected to find a EyeShuttleController for {AttachedObject.name}!", MessageType.Warning);
                        return(false);
                    }

                    if (!shuttleController._isPlayerInside)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Beispiel #2
0
            private static void PreAddSector(Sector sector, DynamicOccupant ____occupantType)
            {
                if (!Instance._sectorWhitelist.Contains(sector.GetName()))
                {
                    return;
                }

                if (____occupantType == DynamicOccupant.Player && PlayerTransformSync.LocalInstance != null)
                {
                    PlayerTransformSync.LocalInstance.EnterSector(sector);
                    return;
                }

                if (____occupantType == DynamicOccupant.Ship && ShipTransformSync.LocalInstance != null)
                {
                    ShipTransformSync.LocalInstance.EnterSector(sector);
                }
            }