Exemple #1
0
        private void HandleParenting(List <EntitySpawnPoint> spawnPoints, EntitySpawnPoint entitySpawnPoint, GameObject gameObject)
        {
            EntitySpawnPoint parent;

            if (gameObject.Parent != null && spawnPointsByUid.TryGetValue(gameObject.Parent, out parent))
            {
                entitySpawnPoint.Parent = parent;
                parent.Children.Add(entitySpawnPoint);
            }

            spawnPointsByUid[gameObject.Id] = entitySpawnPoint;

            if (gameObject.Parent == null)
            {
                spawnPoints.Add(
                    entitySpawnPoint
                    );
            }
        }
Exemple #2
0
        public void ParseFile(Int3 batchId, string pathPrefix, string prefix, string suffix, List <EntitySpawnPoint> spawnPoints)
        {
            List <string>     errors         = new List <string>();
            Optional <string> subnauticaPath = GameInstallationFinder.Instance.FindGame(errors);

            if (subnauticaPath.IsEmpty())
            {
                Log.Info($"Could not locate Subnautica installation directory: {Environment.NewLine}{string.Join(Environment.NewLine, errors)}");
                return;
            }

            string path     = Path.Combine(subnauticaPath.Get(), "SNUnmanagedData", "Build18");
            string fileName = Path.Combine(path, pathPrefix, prefix + "batch-cells-" + batchId.x + "-" + batchId.y + "-" + batchId.z + suffix + ".bin");

            if (!File.Exists(fileName))
            {
                //Log.Debug("File does not exist: " + fileName);
                return;
            }

            using (Stream stream = File.OpenRead(fileName))
            {
                CellManager.CellsFileHeader cellsFileHeader = serializer.Deserialize <CellManager.CellsFileHeader>(stream);

                for (int cellCounter = 0; cellCounter < cellsFileHeader.numCells; cellCounter++)
                {
                    CellManager.CellHeader cellHeader = serializer.Deserialize <CellManager.CellHeader>(stream);

                    ProtobufSerializer.LoopHeader gameObjectCount = serializer.Deserialize <ProtobufSerializer.LoopHeader>(stream);

                    for (int goCounter = 0; goCounter < gameObjectCount.Count; goCounter++)
                    {
                        GameObject gameObject = DeserializeGameObject(stream);

                        EntitySpawnPoint esp = EntitySpawnPoint.From(batchId, gameObject, cellHeader);
                        spawnPoints.Add(esp);
                    }
                }
            }
        }
Exemple #3
0
        public void ParseFile(Int3 batchId, string pathPrefix, string suffix, List <EntitySpawnPoint> spawnPoints)
        {
            Optional <string> subnauticaPath = SteamHelper.FindSubnauticaPath();

            if (subnauticaPath.IsEmpty())
            {
                Log.Info("Could not locate subnautica root in steam using fallback");
                subnauticaPath = Optional <string> .Of(Path.GetFullPath("."));
            }

            string path     = Path.Combine(subnauticaPath.Get(), "SNUnmanagedData/Build18");
            string fileName = Path.Combine(path, pathPrefix + "batch-cells-" + batchId.x + "-" + batchId.y + "-" + batchId.z + "-" + suffix + ".bin");

            if (!File.Exists(fileName))
            {
                Log.Info("Fallback path and Steam path failed! Please move SNUnmanagedData/Build18 to {0}", Path.Combine(Path.GetFullPath("."), "\\SNUnmanagedData\\Build18"));
                return;
            }

            using (Stream stream = File.OpenRead(fileName))
            {
                CellManager.CellsFileHeader cellsFileHeader = serializer.Deserialize <CellManager.CellsFileHeader>(stream);

                for (int cellCounter = 0; cellCounter < cellsFileHeader.numCells; cellCounter++)
                {
                    CellManager.CellHeader        cellHeader      = serializer.Deserialize <CellManager.CellHeader>(stream);
                    ProtobufSerializer.LoopHeader gameObjectCount = serializer.Deserialize <ProtobufSerializer.LoopHeader>(stream);

                    for (int goCounter = 0; goCounter < gameObjectCount.Count; goCounter++)
                    {
                        GameObject gameObject = DeserializeGameObject(stream);

                        EntitySpawnPoint esp = EntitySpawnPoint.From(batchId, gameObject, cellHeader);
                        spawnPoints.Add(esp);
                    }
                }
            }
        }
Exemple #4
0
        public void ParseFile(Int3 batchId, string pathPrefix, string suffix, List <EntitySpawnPoint> spawnPoints)
        {
            Optional <string> subnauticaPath = SteamHelper.FindSubnauticaPath();

            if (subnauticaPath.IsEmpty())
            {
                throw new InvalidOperationException("Could not locate subnautica root");
            }

            string path     = Path.Combine(subnauticaPath.Get(), "SNUnmanagedData/Build18");
            string fileName = Path.Combine(path, pathPrefix + "batch-cells-" + batchId.x + "-" + batchId.y + "-" + batchId.z + "-" + suffix + ".bin");

            if (!File.Exists(fileName))
            {
                return;
            }

            using (Stream stream = File.OpenRead(fileName))
            {
                CellManager.CellsFileHeader cellsFileHeader = serializer.Deserialize <CellManager.CellsFileHeader>(stream);

                for (int cellCounter = 0; cellCounter < cellsFileHeader.numCells; cellCounter++)
                {
                    CellManager.CellHeader        cellHeader      = serializer.Deserialize <CellManager.CellHeader>(stream);
                    ProtobufSerializer.LoopHeader gameObjectCount = serializer.Deserialize <ProtobufSerializer.LoopHeader>(stream);

                    for (int goCounter = 0; goCounter < gameObjectCount.Count; goCounter++)
                    {
                        GameObject gameObject = DeserializeGameObject(stream);

                        EntitySpawnPoint esp = EntitySpawnPoint.From(batchId, gameObject, cellHeader);
                        spawnPoints.Add(esp);
                    }
                }
            }
        }