private void OnMapRegionGen(IMapRegion mapRegion, int regionX, int regionZ) { int pad = TerraGenConfig.geoProvMapPadding; mapRegion.GeologicProvinceMap.Data = geologicprovinceGen.GenLayer( regionX * noiseSizeGeoProv - pad, regionZ * noiseSizeGeoProv - pad, noiseSizeGeoProv + 2 * pad, noiseSizeGeoProv + 2 * pad ); mapRegion.GeologicProvinceMap.Size = noiseSizeGeoProv + 2 * pad; mapRegion.GeologicProvinceMap.TopLeftPadding = mapRegion.GeologicProvinceMap.BottomRightPadding = pad; pad = 2; mapRegion.ClimateMap.Data = climateGen.GenLayer( regionX * noiseSizeClimate - pad, regionZ * noiseSizeClimate - pad, noiseSizeClimate + 2 * pad, noiseSizeClimate + 2 * pad ); mapRegion.ClimateMap.Size = noiseSizeClimate + 2 * pad; mapRegion.ClimateMap.TopLeftPadding = mapRegion.ClimateMap.BottomRightPadding = pad; mapRegion.ForestMap.Size = noiseSizeForest + 1; mapRegion.ForestMap.BottomRightPadding = 1; forestGen.SetInputMap(mapRegion.ClimateMap, mapRegion.ForestMap); mapRegion.ForestMap.Data = forestGen.GenLayer(regionX * noiseSizeForest, regionZ * noiseSizeForest, noiseSizeForest + 1, noiseSizeForest + 1); mapRegion.BeachMap.Size = noiseSizeBeach + 1; mapRegion.BeachMap.BottomRightPadding = 1; mapRegion.BeachMap.Data = beachGen.GenLayer(regionX * noiseSizeBeach, regionZ * noiseSizeBeach, noiseSizeBeach + 1, noiseSizeBeach + 1); mapRegion.ShrubMap.Size = noiseSizeShrubs + 1; mapRegion.ShrubMap.BottomRightPadding = 1; bushGen.SetInputMap(mapRegion.ClimateMap, mapRegion.ShrubMap); mapRegion.ShrubMap.Data = bushGen.GenLayer(regionX * noiseSizeShrubs, regionZ * noiseSizeShrubs, noiseSizeShrubs + 1, noiseSizeShrubs + 1); mapRegion.FlowerMap.Size = noiseSizeForest + 1; mapRegion.FlowerMap.BottomRightPadding = 1; flowerGen.SetInputMap(mapRegion.ClimateMap, mapRegion.FlowerMap); mapRegion.FlowerMap.Data = flowerGen.GenLayer(regionX * noiseSizeForest, regionZ * noiseSizeForest, noiseSizeForest + 1, noiseSizeForest + 1); pad = TerraGenConfig.landformMapPadding; mapRegion.LandformMap.Data = landformsGen.GenLayer(regionX * noiseSizeLandform - pad, regionZ * noiseSizeLandform - pad, noiseSizeLandform + 2 * pad, noiseSizeLandform + 2 * pad); mapRegion.LandformMap.Size = noiseSizeLandform + 2 * pad; mapRegion.LandformMap.TopLeftPadding = mapRegion.LandformMap.BottomRightPadding = pad; mapRegion.DirtyForSaving = true; }
private void OnMapRegionGen(IMapRegion mapRegion, int regionX, int regionZ) { /*mapRegion.DepositDistortionMap.Size = noiseSizeDepositDistortion + 1; * mapRegion.DepositDistortionMap.BottomRightPadding = 1; * mapRegion.DepositDistortionMap.Data = depositDistortionGen.GenLayer(regionX * noiseSizeDepositDistortion, regionZ * noiseSizeDepositDistortion, noiseSizeDepositDistortion + 1, noiseSizeDepositDistortion + 1);*/ int pad = TerraGenConfig.geoProvMapPadding; mapRegion.GeologicProvinceMap.Data = geologicprovinceGen.GenLayer( regionX * noiseSizeGeoProv - pad, regionZ * noiseSizeGeoProv - pad, noiseSizeGeoProv + 2 * pad, noiseSizeGeoProv + 2 * pad ); mapRegion.GeologicProvinceMap.Size = noiseSizeGeoProv + 2 * pad; mapRegion.GeologicProvinceMap.TopLeftPadding = mapRegion.GeologicProvinceMap.BottomRightPadding = pad; mapRegion.ClimateMap.Size = noiseSizeClimate + 1; mapRegion.ClimateMap.BottomRightPadding = 1; mapRegion.ClimateMap.Data = climateGen.GenLayer(regionX * noiseSizeClimate, regionZ * noiseSizeClimate, noiseSizeClimate + 1, noiseSizeClimate + 1); mapRegion.ForestMap.Size = noiseSizeForest + 1; mapRegion.ForestMap.BottomRightPadding = 1; forestGen.SetInputMap(mapRegion.ClimateMap, mapRegion.ForestMap); mapRegion.ForestMap.Data = forestGen.GenLayer(regionX * noiseSizeForest, regionZ * noiseSizeForest, noiseSizeForest + 1, noiseSizeForest + 1); mapRegion.ShrubMap.Size = noiseSizeShrubs + 1; mapRegion.ShrubMap.BottomRightPadding = 1; bushGen.SetInputMap(mapRegion.ClimateMap, mapRegion.ShrubMap); mapRegion.ShrubMap.Data = bushGen.GenLayer(regionX * noiseSizeShrubs, regionZ * noiseSizeShrubs, noiseSizeShrubs + 1, noiseSizeShrubs + 1); mapRegion.FlowerMap.Size = noiseSizeForest + 1; mapRegion.FlowerMap.BottomRightPadding = 1; flowerGen.SetInputMap(mapRegion.ClimateMap, mapRegion.FlowerMap); mapRegion.FlowerMap.Data = flowerGen.GenLayer(regionX * noiseSizeForest, regionZ * noiseSizeForest, noiseSizeForest + 1, noiseSizeForest + 1); pad = TerraGenConfig.landformMapPadding; mapRegion.LandformMap.Data = landformsGen.GenLayer(regionX * noiseSizeLandform - pad, regionZ * noiseSizeLandform - pad, noiseSizeLandform + 2 * pad, noiseSizeLandform + 2 * pad); mapRegion.LandformMap.Size = noiseSizeLandform + 2 * pad; mapRegion.LandformMap.TopLeftPadding = mapRegion.LandformMap.BottomRightPadding = pad; //Console.WriteLine("map region {0} {1} generated", regionX, regionZ); mapRegion.DirtyForSaving = true; }
void TestMap(IServerPlayer player, CmdArgs arguments) { if (arguments.Length < 2) { player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov|landform|ore]", EnumChatType.CommandError); return; } Random rnd = new Random(); long seed = rnd.Next(); switch (arguments[1]) { case "climate": { NoiseBase.Debug = true; NoiseClimatePatchy noiseClimate = new NoiseClimatePatchy(seed); MapLayerBase climate = GenMaps.GetClimateMapGen(seed, noiseClimate); player.SendMessage(groupId, "Patchy climate map generated", EnumChatType.CommandSuccess); } break; case "climater": { NoiseBase.Debug = false; NoiseClimateRealistic noiseClimate = new NoiseClimateRealistic(seed, api.World.BlockAccessor.MapSizeZ / TerraGenConfig.climateMapScale / TerraGenConfig.climateMapSubScale); MapLayerBase climate = GenMaps.GetClimateMapGen(seed, noiseClimate); NoiseBase.DebugDrawBitmap(DebugDrawMode.RGB, climate.GenLayer(0, 0, 128, 2048), 128, 2048, "realisticlimate"); player.SendMessage(groupId, "Realistic climate map generated", EnumChatType.CommandSuccess); } break; case "forest": { NoiseBase.Debug = false; NoiseClimatePatchy noiseClimate = new NoiseClimatePatchy(seed); MapLayerBase climate = GenMaps.GetClimateMapGen(seed, noiseClimate); MapLayerBase forest = GenMaps.GetForestMapGen(seed + 1, TerraGenConfig.forestMapScale); IntMap climateMap = new IntMap() { Data = climate.GenLayer(0, 0, 512, 512), Size = 512 }; forest.SetInputMap(climateMap, new IntMap() { Size = 512 }); NoiseBase.Debug = true; forest.DebugDrawBitmap(DebugDrawMode.FirstByteGrayscale, 0, 0, "Forest 1 - Forest"); player.SendMessage(groupId, "Forest map generated", EnumChatType.CommandSuccess); } break; case "ore": { NoiseBase.Debug = false; NoiseOre noiseOre = new NoiseOre(seed); MapLayerBase climate = GenMaps.GetOreMap(seed, noiseOre); NoiseBase.Debug = true; climate.DebugDrawBitmap(DebugDrawMode.RGB, 0, 0, 1024, "Ore 1 - Ore"); player.SendMessage(groupId, "ore map generated", EnumChatType.CommandSuccess); } break; case "oretopdistort": NoiseBase.Debug = true; NoiseBase topdistort = GenMaps.GetDepositVerticalDistort(seed); player.SendMessage(groupId, "Ore top distort map generated", EnumChatType.CommandSuccess); break; case "wind": NoiseBase.Debug = true; NoiseBase wind = GenMaps.GetDebugWindMap(seed); player.SendMessage(groupId, "Wind map generated", EnumChatType.CommandSuccess); break; case "gprov": NoiseBase.Debug = true; MapLayerBase provinces = GenMaps.GetGeologicProvinceMapGen(seed, api); player.SendMessage(groupId, "Province map generated", EnumChatType.CommandSuccess); break; case "landform": { NoiseBase.Debug = true; NoiseClimatePatchy noiseClimate = new NoiseClimatePatchy(seed); MapLayerBase landforms = GenMaps.GetLandformMapGen(seed + 1, noiseClimate, api); player.SendMessage(groupId, "Landforms map generated", EnumChatType.CommandSuccess); } break; case "rockstrata": { NoiseBase.Debug = true; GenRockStrataNew mod = api.ModLoader.GetModSystem <GenRockStrataNew>(); for (int i = 0; i < mod.strataNoises.Length; i++) { mod.strataNoises[i].DebugDrawBitmap(DebugDrawMode.FirstByteGrayscale, 0, 0, "Rockstrata-" + mod.strata.Variants[i].BlockCode); } player.SendMessage(groupId, "Rockstrata maps generated", EnumChatType.CommandSuccess); } break; default: player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov]", EnumChatType.CommandError); break; } NoiseBase.Debug = false; }
void TestMap(IServerPlayer player, CmdArgs arguments) { if (arguments.Length < 2) { player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov|landform|ore]", EnumChatType.CommandError); return; } Random rnd = new Random(); long seed = rnd.Next(); switch (arguments[1]) { case "climate": { NoiseBase.Debug = true; NoiseClimate noiseClimate = new NoiseClimate(seed); MapLayerBase climate = GenMaps.GetClimateMap(seed, noiseClimate); player.SendMessage(groupId, "Climate map generated", EnumChatType.CommandSuccess); } break; case "forest": { NoiseBase.Debug = false; NoiseClimate noiseClimate = new NoiseClimate(seed); MapLayerBase climate = GenMaps.GetClimateMap(seed, noiseClimate); MapLayerBase forest = GenMaps.GetForestMap(seed + 1, TerraGenConfig.forestMapScale); IntMap climateMap = new IntMap() { Data = climate.GenLayer(0, 0, 512, 512), Size = 512 }; forest.SetInputMap(climateMap, new IntMap() { Size = 512 }); NoiseBase.Debug = true; forest.DebugDrawBitmap(1, 0, 0, "Forest 1 - Forest"); player.SendMessage(groupId, "Forest map generated", EnumChatType.CommandSuccess); } break; case "ore": { NoiseBase.Debug = false; NoiseOre noiseOre = new NoiseOre(seed); MapLayerBase climate = GenMaps.GetOreMap(seed, noiseOre); NoiseBase.Debug = true; climate.DebugDrawBitmap(0, 0, 0, 1024, "Ore 1 - Ore"); player.SendMessage(groupId, "ore map generated", EnumChatType.CommandSuccess); } break; case "wind": NoiseBase.Debug = true; NoiseBase wind = GenMaps.GetDebugWindMap(seed); player.SendMessage(groupId, "Wind map generated", EnumChatType.CommandSuccess); break; case "gprov": NoiseBase.Debug = true; MapLayerBase provinces = GenMaps.GetGeologicProvinceMap(seed, api); player.SendMessage(groupId, "Province map generated", EnumChatType.CommandSuccess); break; case "landform": { NoiseBase.Debug = true; NoiseClimate noiseClimate = new NoiseClimate(seed); MapLayerBase landforms = GenMaps.GetLandformMap(seed + 1, noiseClimate, api); player.SendMessage(groupId, "Landforms map generated", EnumChatType.CommandSuccess); } break; default: player.SendMessage(groupId, "/wgen testmap [climate|forest|wind|gprov]", EnumChatType.CommandError); break; } NoiseBase.Debug = false; }