Beispiel #1
0
        internal List <BiomeData> GetBiomeData()
        {
            if (this.TechToCopy != TechType.None && !BiomeData.Any())
            {
                // This will load the games distribution data and then return the biome distribution list for the techtype you tried to copy from if it has one.
                LootDistributionData data = LootDistributionData.Load("Balance/EntityDistributions");
                if (data.GetPrefabData(CraftData.GetClassIdForTechType(TechToCopy), out SrcData srcData))
                {
                    return(srcData.distribution);
                }
            }

            return(BiomeData ?? new List <BiomeData>());
        }
Beispiel #2
0
        private static void EnsureDefaultDistributions()
        {
            if (!File.Exists(DefaultDistributions))
            {
                PrefabDatabase.LoadPrefabDatabase(SNUtils.prefabDatabaseFilename);
            }
            {
                SortedDictionary <string, List <BiomeData> > defaultDistributions = new SortedDictionary <string, List <BiomeData> >();
                LootDistributionData data = LootDistributionData.Load("Balance/EntityDistributions");
                foreach (KeyValuePair <string, SrcData> pair in data.srcDistribution)
                {
                    if (WorldEntityDatabase.TryGetInfo(pair.Key, out WorldEntityInfo info))
                    {
                        if (info.techType != TechType.None)
                        {
                            defaultDistributions[info.techType.AsString()] = pair.Value.distribution;
                        }
                    }
                }

                using (StreamWriter writer = new StreamWriter(DefaultDistributions))
                {
                    writer.Write(JsonConvert.SerializeObject(defaultDistributions, Formatting.Indented, new JsonConverter[] {
                        new StringEnumConverter()
                        {
#if SUBNAUTICA_STABLE
                            CamelCaseText = true,
#else
                            NamingStrategy = new CamelCaseNamingStrategy(),
#endif
                            AllowIntegerValues = true
                        },

                        new TechTypeConverter()
                    }));
                }
            }
        }
Beispiel #3
0
        public static void Load()
        {
            LootDistributionData data       = LootDistributionData.Load("Balance/EntityDistributions");
            List <TechType>      Drillables = Enum.GetValues(typeof(TechType)).OfType <TechType>().Where((tt) => tt.AsString().Contains("Drillable")).ToList();

            data.GetPrefabData(CraftData.GetClassIdForTechType(TechType.DrillableUranium), out SrcData UraniumData);
            foreach (TechType techType in Drillables)
            {
                string classId = CraftData.GetClassIdForTechType(techType);

                if (CraftData.GetPrefabForTechType(techType, false) == null)
                {
                    continue;
                }

                if (WorldEntityDatabase.TryGetInfo(classId, out WorldEntityInfo info))
                {
                    if (!data.GetPrefabData(classId, out SrcData srcData))
                    {
                        SMLHelper.V2.Handler.LootDistributionHandler.AddLootDistributionData(classId, UraniumData);
                    }
                }
            }
        }