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 GenMap(IServerPlayer player, CmdArgs arguments) { if (arguments.Length < 2) { player.SendMessage(groupId, "/wgen genmap [climate|forest|wind|gprov|landform|ore]", EnumChatType.CommandError); return; } int seed = api.World.Seed; BlockPos pos = player.Entity.ServerPos.XYZ.AsBlockPos; int noiseSizeClimate = api.WorldManager.RegionSize / TerraGenConfig.climateMapScale; int noiseSizeForest = api.WorldManager.RegionSize / TerraGenConfig.forestMapScale; int noiseSizeShrubs = api.WorldManager.RegionSize / TerraGenConfig.shrubMapScale; int noiseSizeGeoProv = api.WorldManager.RegionSize / TerraGenConfig.geoProvMapScale; int noiseSizeLandform = api.WorldManager.RegionSize / TerraGenConfig.landformMapScale; NoiseClimatePatchy noiseClimate = new NoiseClimatePatchy(seed); MapLayerBase climateGen = GenMaps.GetClimateMapGen(seed + 1, noiseClimate); MapLayerBase forestGen = GenMaps.GetForestMapGen(seed + 2, TerraGenConfig.forestMapScale); MapLayerBase bushGen = GenMaps.GetForestMapGen(seed + 109, TerraGenConfig.shrubMapScale); MapLayerBase flowerGen = GenMaps.GetForestMapGen(seed + 223, TerraGenConfig.forestMapScale); MapLayerBase geologicprovinceGen = GenMaps.GetGeologicProvinceMapGen(seed + 3, api); MapLayerBase landformsGen = GenMaps.GetLandformMapGen(seed + 4, noiseClimate, api); int regionX = pos.X / api.WorldManager.RegionSize; int regionZ = pos.Z / api.WorldManager.RegionSize; int chunkSize = api.WorldManager.ChunkSize; NoiseBase.Debug = true; switch (arguments[1]) { case "climate": { int startX = regionX * noiseSizeClimate - 256; int startZ = regionZ * noiseSizeClimate - 256; climateGen.DebugDrawBitmap(DebugDrawMode.RGB, startX, startZ, "climatemap"); player.SendMessage(groupId, "Climate map generated", EnumChatType.CommandSuccess); } break; case "forest": { int startX = regionX * noiseSizeForest - 256; int startZ = regionZ * noiseSizeForest - 256; forestGen.DebugDrawBitmap(DebugDrawMode.FirstByteGrayscale, startX, startZ, "forestmap"); player.SendMessage(groupId, "Forest map generated", EnumChatType.CommandSuccess); } break; case "ore": { /*NoiseOre noiseOre = new NoiseOre(seed); * MapLayerBase climate = GenMaps.GetOreMap(seed, noiseOre); * * climate.DebugDrawBitmap(0, 0, 0, 1024, "Ore 1 - Ore"); * player.SendMessage(groupId, "ore map generated", EnumChatType.CommandSuccess);*/ } break; case "gprov": { int startX = regionX * noiseSizeGeoProv - 256; int startZ = regionZ * noiseSizeGeoProv - 256; geologicprovinceGen.DebugDrawBitmap(DebugDrawMode.ProvinceRGB, startX, startZ, "gprovmap"); player.SendMessage(groupId, "Province map generated", EnumChatType.CommandSuccess); break; } case "landform": { int startX = regionX * noiseSizeLandform - 256; int startZ = regionZ * noiseSizeLandform - 256; landformsGen.DebugDrawBitmap(DebugDrawMode.LandformRGB, startX, startZ, "landformmap"); 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; }
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; }