Exemplo n.º 1
0
 public void ReloadSpawnmap()
 {
     if (Spawnmap != null && Spawnmap.LoadSourceImage())
     {
         Spawnmap.CreateMap();
     }
 }
Exemplo n.º 2
0
            public void SetSpawnmapPath(string path, string projectDir = null)
            {
                var finalPath = SpawnmapPath(path, projectDir);

                if (!string.IsNullOrEmpty(finalPath))
                {
                    Spawnmap = new ImageMapSpawn(finalPath);
                    if (!Spawnmap.LoadSourceImage() || !Spawnmap.CreateMap())
                    {
                        Spawnmap = null;
                    }
                }
                else
                {
                    Spawnmap = null;
                }
            }
Exemplo n.º 3
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;
                }
            }
Exemplo n.º 4
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);
                }
            }