Example #1
0
 public void ReloadRoughmap()
 {
     if (Roughmap != null && Roughmap.LoadSourceImage())
     {
         Roughmap.CreateMap();
     }
 }
Example #2
0
 public void ReloadForestmap()
 {
     if (Forestmap != null && Forestmap.LoadSourceImage())
     {
         Forestmap.CreateMap();
     }
 }
Example #3
0
 public void ReloadHeightmap()
 {
     if (Heightmap != null && Heightmap.LoadSourceImage())
     {
         Heightmap.CreateMap();
     }
 }
Example #4
0
 public void ReloadFlatmap()
 {
     if (UseRoughInvertedAsFlat)
     {
         ReloadRoughmap();
     }
     else if (Flatmap != null && Flatmap.LoadSourceImage())
     {
         Flatmap.CreateMap();
     }
 }
Example #5
0
            public void SetForestmapPath(string path, string projectDir = null)
            {
                var finalPath = ForestmapPath(path, projectDir);

                if (!string.IsNullOrEmpty(finalPath))
                {
                    Forestmap = new ImageMapFloat(finalPath);
                    if (!Forestmap.LoadSourceImage() || !Forestmap.CreateMap())
                    {
                        Forestmap = null;
                    }
                }
                else
                {
                    Forestmap = null;
                }
            }
Example #6
0
            public void SetFlatmapPath(string path, string projectDir = null)
            {
                var finalPath = FlatmapPath(path, projectDir);

                if (!string.IsNullOrEmpty(finalPath) && !UseRoughInvertedAsFlat)
                {
                    Flatmap = new ImageMapFloat(finalPath);
                    if (!Flatmap.LoadSourceImage() || !Flatmap.CreateMap())
                    {
                        Flatmap = null;
                    }
                }
                else
                {
                    Flatmap = null;
                }
            }
Example #7
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;
                }
            }
Example #8
0
            private void InitSettings(long worldUId, bool enabled)
            {
                Log($"Init settings for new world");

                Version = LatestVersion;

                WorldUId = worldUId;

                EnabledForThisWorld = enabled;

                if (EnabledForThisWorld)
                {
                    SetContinentSize(ConfigContinentSize.Value);
                    SetMountainsAmount(ConfigMountainsAmount.Value);
                    SetSeaLevelAdjustment(ConfigSeaLevelAdjustment.Value);

                    SetMaxRidgeHeight(ConfigMaxRidgeHeight.Value);
                    SetRidgeSize(ConfigRidgeSize.Value);
                    SetRidgeBlend(ConfigRidgeBlend.Value);
                    SetRidgeAmount(ConfigRidgeAmount.Value);

                    var heightmapPath = HeightmapPath(ConfigHeightmapFile.Value, ConfigMapSourceDir.Value);
                    if (!string.IsNullOrEmpty(heightmapPath))
                    {
                        SetHeightmapAmount(ConfigHeightmapAmount.Value);
                        SetHeightmapBlend(ConfigHeightmapBlend.Value);
                        SetHeightmapAdd(ConfigHeightmapAdd.Value);
                        SetHeightmapMask(ConfigHeightmapMask.Value);
                        SetHeightmapOverrideAll(ConfigHeightmapOverrideAll.Value);

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

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

                    SetOceanChannelsEnabled(ConfigOceanChannelsEnabled.Value);
                    SetRiversEnabled(ConfigRiversEnabled.Value);

                    SetForestScale(ConfigForestScale.Value);
                    SetForestAmount(ConfigForestAmount.Value);
                    SetForestFactorOverrideAllTrees(ConfigForestFactorOverrideAllTrees.Value);

                    SetOverrideStartPosition(ConfigOverrideStartPosition.Value);
                    SetStartPositionX(ConfigStartPositionX.Value);
                    SetStartPositionY(ConfigStartPositionY.Value);
                    //LakesEnabled = ConfigLakesEnabled.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))
                    {
                        SetRoughmapBlend(ConfigRoughmapBlend.Value);

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

                    var flatmapPath = ConfigUseRoughInvertedForFlat.Value ? null : FlatmapPath(ConfigFlatmapFile.Value, ConfigMapSourceDir.Value);
                    if (ConfigUseRoughInvertedForFlat.Value && Roughmap != null ||
                        !ConfigUseRoughInvertedForFlat.Value && !string.IsNullOrEmpty(flatmapPath))
                    {
                        SetUseRoughInvertedForFlat(ConfigUseRoughInvertedForFlat.Value);
                        SetFlatmapBlend(ConfigFlatmapBlend.Value);
                        if (!string.IsNullOrEmpty(flatmapPath) && !UseRoughInvertedAsFlat)
                        {
                            Flatmap = new ImageMapFloat(flatmapPath);
                            if (!Flatmap.LoadSourceImage() || !Flatmap.CreateMap())
                            {
                                Flatmap = null;
                            }
                        }
                    }

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

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

                    SetMapEdgeDropoff(ConfigMapEdgeDropoff.Value);
                    SetMountainsAllowedAtCenter(ConfigMountainsAllowedAtCenter.Value);
                }
            }