コード例 #1
0
        public static NoiseStackSettings Default()
        {
            var val = new NoiseStackSettings();

            val.NoiseLayers.Add(new NoiseLayer());
            return(val);
        }
コード例 #2
0
 public NoiseStack(int seed, NoiseStackSettings settings)
 {
     for (var layerIndex = 0; layerIndex < settings.NoiseLayers.Count; layerIndex++)
     {
         var layerSettings = settings.NoiseLayers[layerIndex];
         layers.Add(new NoiseLayer(seed * 31 * (layerIndex + 3), layerSettings));
     }
 }
コード例 #3
0
        public static NoiseStackSettings Deserialize(ZPackage pkg)
        {
            var stack           = new NoiseStackSettings();
            int noiseLayerCount = pkg.ReadInt();

            for (int i = 0; i < noiseLayerCount; i++)
            {
                stack.NoiseLayers.Add(NoiseLayer.Deserialize(pkg));
            }
            return(stack);
        }
コード例 #4
0
            private void InitSettings(long worldUId, bool enabled)
            {
                Log($"Init settings for new world");

                Version = LatestVersion;

                WorldUId = worldUId;

                EnabledForThisWorld = enabled;

                if (EnabledForThisWorld)
                {
                    ContinentSize = ConfigContinentSize.Value;
                    SeaLevel      = ConfigSeaLevelAdjustment.Value;

                    var heightmapPath = HeightmapPath(ConfigHeightmapFile.Value, ConfigMapSourceDir.Value);
                    if (!string.IsNullOrEmpty(heightmapPath))
                    {
                        HeightmapAmount      = ConfigHeightmapAmount.Value;
                        HeightmapBlend       = ConfigHeightmapBlend.Value;
                        HeightmapAdd         = ConfigHeightmapAdd.Value;
                        HeightmapMask        = ConfigHeightmapMask.Value;
                        HeightmapOverrideAll = ConfigHeightmapOverrideAll.Value;

                        Heightmap = new ImageMapFloat(heightmapPath);
                        if (!Heightmap.LoadSourceImage() || !Heightmap.CreateMap())
                        {
                            Heightmap = null;
                        }
                    }

                    BaseHeightNoise = NoiseStackSettings.Default();

                    var biomemapPath = BiomemapPath(ConfigBiomemapFile.Value, ConfigMapSourceDir.Value);
                    if (!string.IsNullOrEmpty(biomemapPath))
                    {
                        Biomemap = new ImageMapBiome(biomemapPath);
                        if (!Biomemap.LoadSourceImage() || !Biomemap.CreateMap())
                        {
                            Biomemap = null;
                        }
                    }

                    OceanChannelsEnabled = ConfigOceanChannelsEnabled.Value;
                    RiversEnabled        = ConfigRiversEnabled.Value;

                    ForestScaleFactor            = ConfigForestScale.Value;
                    ForestAmount                 = ConfigForestAmount.Value;
                    ForestFactorOverrideAllTrees = ConfigForestFactorOverrideAllTrees.Value;

                    OverrideStartPosition = ConfigOverrideStartPosition.Value;
                    StartPositionX        = ConfigStartPositionX.Value;
                    StartPositionY        = ConfigStartPositionY.Value;

                    var spawnmapPath = SpawnmapPath(ConfigSpawnmapFile.Value, ConfigMapSourceDir.Value);
                    if (!string.IsNullOrEmpty(spawnmapPath))
                    {
                        Spawnmap = new ImageMapSpawn(spawnmapPath);
                        if (!Spawnmap.LoadSourceImage() || !Spawnmap.CreateMap())
                        {
                            Spawnmap = null;
                        }
                    }

                    var roughmapPath = RoughmapPath(ConfigRoughmapFile.Value, ConfigMapSourceDir.Value);
                    if (!string.IsNullOrEmpty(roughmapPath))
                    {
                        RoughmapBlend = ConfigRoughmapBlend.Value;

                        Roughmap = new ImageMapFloat(roughmapPath);
                        if (!Roughmap.LoadSourceImage() || !Roughmap.CreateMap())
                        {
                            Roughmap = null;
                        }
                    }

                    var forestmapPath = ForestmapPath(ConfigForestmapFile.Value, ConfigMapSourceDir.Value);
                    if (!string.IsNullOrEmpty(forestmapPath))
                    {
                        ForestmapAdd      = ConfigForestmapAdd.Value;
                        ForestmapMultiply = ConfigForestmapMultiply.Value;

                        Forestmap = new ImageMapFloat(forestmapPath);
                        if (!Forestmap.LoadSourceImage() || !Forestmap.CreateMap())
                        {
                            Forestmap = null;
                        }
                    }

                    MapEdgeDropoff           = ConfigMapEdgeDropoff.Value;
                    MountainsAllowedAtCenter = ConfigMountainsAllowedAtCenter.Value;
                }
            }