public void initWorldGen() { long seed = api.WorldManager.Seed; noiseSizeClimate = api.WorldManager.RegionSize / TerraGenConfig.climateMapScale; noiseSizeForest = api.WorldManager.RegionSize / TerraGenConfig.forestMapScale; noiseSizeShrubs = api.WorldManager.RegionSize / TerraGenConfig.shrubMapScale; noiseSizeGeoProv = api.WorldManager.RegionSize / TerraGenConfig.geoProvMapScale; noiseSizeLandform = api.WorldManager.RegionSize / TerraGenConfig.landformMapScale; ITreeAttribute tree = api.WorldManager.SaveGame.WorldConfiguration; string climate = tree.GetString("worldClimate"); NoiseClimate noiseClimate; switch (climate) { case "realistic": noiseClimate = new NoiseClimateRealistic(seed, (double)api.WorldManager.MapSizeZ / TerraGenConfig.climateMapScale / TerraGenConfig.climateMapSubScale); break; default: noiseClimate = new NoiseClimatePatchy(seed); break; } climateGen = GetClimateMapGen(seed + 1, noiseClimate); forestGen = GetForestMapGen(seed + 2, TerraGenConfig.forestMapScale); bushGen = GetForestMapGen(seed + 109, TerraGenConfig.shrubMapScale); flowerGen = GetForestMapGen(seed + 223, TerraGenConfig.forestMapScale); geologicprovinceGen = GetGeologicProvinceMapGen(seed + 3, api); landformsGen = GetLandformMapGen(seed + 4, noiseClimate, api); }
public void initWorldGen() { long seed = api.WorldManager.Seed; noiseSizeClimate = api.WorldManager.RegionSize / TerraGenConfig.climateMapScale; noiseSizeForest = api.WorldManager.RegionSize / TerraGenConfig.forestMapScale; noiseSizeShrubs = api.WorldManager.RegionSize / TerraGenConfig.shrubMapScale; noiseSizeGeoProv = api.WorldManager.RegionSize / TerraGenConfig.geoProvMapScale; noiseSizeLandform = api.WorldManager.RegionSize / TerraGenConfig.landformMapScale; noiseSizeBeach = api.WorldManager.RegionSize / TerraGenConfig.beachMapScale; ITreeAttribute worldConfig = api.WorldManager.SaveGame.WorldConfiguration; string climate = worldConfig.GetString("worldClimate", "realistic"); NoiseClimate noiseClimate; float tempModifier = worldConfig.GetString("globalTemperature", "1").ToFloat(1); float rainModifier = worldConfig.GetString("globalPrecipitation", "1").ToFloat(1); latdata.polarEquatorDistance = worldConfig.GetString("polarEquatorDistance", "50000").ToInt(50000); switch (climate) { case "realistic": int spawnMinTemp = 6; int spawnMaxTemp = 14; string startingClimate = worldConfig.GetString("startingClimate"); switch (startingClimate) { case "hot": spawnMinTemp = 28; spawnMaxTemp = 32; break; case "warm": spawnMinTemp = 19; spawnMaxTemp = 23; break; case "cool": spawnMinTemp = -5; spawnMaxTemp = 1; break; case "icy": spawnMinTemp = -15; spawnMaxTemp = -10; break; } noiseClimate = new NoiseClimateRealistic(seed, (double)api.WorldManager.MapSizeZ / TerraGenConfig.climateMapScale / TerraGenConfig.climateMapSubScale, latdata.polarEquatorDistance, spawnMinTemp, spawnMaxTemp); latdata.isRealisticClimate = true; latdata.ZOffset = (noiseClimate as NoiseClimateRealistic).ZOffset; break; default: noiseClimate = new NoiseClimatePatchy(seed); break; } noiseClimate.rainMul = rainModifier; noiseClimate.tempMul = tempModifier; climateGen = GetClimateMapGen(seed + 1, noiseClimate); forestGen = GetForestMapGen(seed + 2, TerraGenConfig.forestMapScale); bushGen = GetForestMapGen(seed + 109, TerraGenConfig.shrubMapScale); flowerGen = GetForestMapGen(seed + 223, TerraGenConfig.forestMapScale); beachGen = GetBeachMapGen(seed + 2273, TerraGenConfig.beachMapScale); geologicprovinceGen = GetGeologicProvinceMapGen(seed + 3, api); landformsGen = GetLandformMapGen(seed + 4, noiseClimate, api); api.ModLoader.GetModSystem <SurvivalCoreSystem>().onGetLatitude = getLatitude; }
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; }