public static void Init(Map map) { Rot4 a = Find.World.CoastDirectionAt(map.Tile); if (!a.IsValid) { beachNoise = null; return; } ModuleBase input = new Perlin(0.029999999329447746, 2.0, 0.5, 3, Rand.Range(0, int.MaxValue), QualityMode.Medium); input = new ScaleBias(0.5, 0.5, input); NoiseDebugUI.StoreNoiseRender(input, "BeachMaker base", map.Size.ToIntVec2); ModuleBase input2 = new DistFromAxis(CoastWidthRange.RandomInRange); if (a == Rot4.North) { input2 = new Rotate(0.0, 90.0, 0.0, input2); input2 = new Translate(0.0, 0.0, -map.Size.z, input2); } else if (a == Rot4.East) { input2 = new Translate(-map.Size.x, 0.0, 0.0, input2); } else if (a == Rot4.South) { input2 = new Rotate(0.0, 90.0, 0.0, input2); } input2 = new ScaleBias(1.0, -1.0, input2); input2 = new Clamp(-1.0, 2.5, input2); NoiseDebugUI.StoreNoiseRender(input2, "BeachMaker axis bias"); beachNoise = new Add(input, input2); NoiseDebugUI.StoreNoiseRender(beachNoise, "beachNoise"); }
public static void Init(Map map) { Rot4 a = Find.World.CoastDirectionAt(map.Tile); if (!a.IsValid) { BeachMaker.beachNoise = null; return; } ModuleBase moduleBase = new Perlin(0.029999999329447746, 2.0, 0.5, 3, Rand.Range(0, int.MaxValue), QualityMode.Medium); moduleBase = new ScaleBias(0.5, 0.5, moduleBase); NoiseDebugUI.StoreNoiseRender(moduleBase, "BeachMaker base", new IntVec2(map.Size.x, map.Size.z)); ModuleBase moduleBase2 = new DistFromAxis(BeachMaker.CoastWidthRange.RandomInRange); if (a == Rot4.North) { moduleBase2 = new Rotate(0.0, 90.0, 0.0, moduleBase2); moduleBase2 = new Translate(0.0, 0.0, (double)(-(double)map.Size.z), moduleBase2); } else if (a == Rot4.East) { moduleBase2 = new Translate((double)(-(double)map.Size.x), 0.0, 0.0, moduleBase2); } else if (a == Rot4.South) { moduleBase2 = new Rotate(0.0, 90.0, 0.0, moduleBase2); } moduleBase2 = new ScaleBias(1.0, -1.0, moduleBase2); moduleBase2 = new Clamp(-1.0, 2.5, moduleBase2); NoiseDebugUI.StoreNoiseRender(moduleBase2, "BeachMaker axis bias"); BeachMaker.beachNoise = new Add(moduleBase, moduleBase2); NoiseDebugUI.StoreNoiseRender(BeachMaker.beachNoise, "beachNoise"); }
public new void changeShape() { ModuleBase moduleBase = new Perlin(1.1, 2, 0.5, 2, Rand.Range(0, this.Props.radius), QualityMode.Medium); moduleBase = new ScaleBias(0.2, 0.2, moduleBase); ModuleBase moduleBase2 = new DistFromAxis(new FloatRange(0, this.Props.radius).RandomInRange); moduleBase2 = new ScaleBias(.2, .2, moduleBase2); moduleBase2 = new Clamp(0, 1, moduleBase2); this.terrainNoise = new Add(moduleBase, moduleBase2); }
public void changeShape() { ModuleBase moduleBase = new Perlin(1.1, 1, 5, 3, this.Props.radius, QualityMode.Medium); moduleBase = new ScaleBias(0.2, 0.2, moduleBase); ModuleBase moduleBase2 = new DistFromAxis(2); moduleBase2 = new ScaleBias(.2, .2, moduleBase2); moduleBase2 = new Clamp(0, 1, moduleBase2); this.terrainNoise = new Add(moduleBase, moduleBase2); }
public static void Init(Map map) { Rot4 a = Find.World.CoastDirectionAt(map.Tile); if (!a.IsValid) { beachNoise = null; } else { ModuleBase input = new Perlin(0.029999999329447746, 2.0, 0.5, 3, Rand.Range(0, 2147483647), QualityMode.Medium); input = new ScaleBias(0.5, 0.5, input); ModuleBase noise = input; IntVec3 size = map.Size; int x = size.x; IntVec3 size2 = map.Size; NoiseDebugUI.StoreNoiseRender(noise, "BeachMaker base", new IntVec2(x, size2.z)); ModuleBase input2 = new DistFromAxis(CoastWidthRange.RandomInRange); if (a == Rot4.North) { input2 = new Rotate(0.0, 90.0, 0.0, input2); IntVec3 size3 = map.Size; input2 = new Translate(0.0, 0.0, (double)(-size3.z), input2); } else if (a == Rot4.East) { IntVec3 size4 = map.Size; input2 = new Translate((double)(-size4.x), 0.0, 0.0, input2); } else if (a == Rot4.South) { input2 = new Rotate(0.0, 90.0, 0.0, input2); } input2 = new ScaleBias(1.0, -1.0, input2); input2 = new Clamp(-1.0, 2.5, input2); NoiseDebugUI.StoreNoiseRender(input2, "BeachMaker axis bias"); beachNoise = new Add(input, input2); NoiseDebugUI.StoreNoiseRender(beachNoise, "beachNoise"); } }
// Token: 0x06004083 RID: 16515 RVA: 0x0015444C File Offset: 0x0015264C public override void Generate(Map map, GenStepParams parms) { NoiseRenderer.renderSize = new IntVec2(map.Size.x, map.Size.z); ModuleBase moduleBase = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High); moduleBase = new ScaleBias(0.5, 0.5, moduleBase); NoiseDebugUI.StoreNoiseRender(moduleBase, "elev base"); float num = 1f; switch (map.TileInfo.hilliness) { case Hilliness.Flat: num = MapGenTuning.ElevationFactorFlat; break; case Hilliness.SmallHills: num = MapGenTuning.ElevationFactorSmallHills; break; case Hilliness.LargeHills: num = MapGenTuning.ElevationFactorLargeHills; break; case Hilliness.Mountainous: num = MapGenTuning.ElevationFactorMountains; break; case Hilliness.Impassable: num = MapGenTuning.ElevationFactorImpassableMountains; break; } moduleBase = new Multiply(moduleBase, new Const((double)num)); NoiseDebugUI.StoreNoiseRender(moduleBase, "elev world-factored"); if (map.TileInfo.hilliness == Hilliness.Mountainous || map.TileInfo.hilliness == Hilliness.Impassable) { ModuleBase moduleBase2 = new DistFromAxis((float)map.Size.x * 0.42f); moduleBase2 = new Clamp(0.0, 1.0, moduleBase2); moduleBase2 = new Invert(moduleBase2); moduleBase2 = new ScaleBias(1.0, 1.0, moduleBase2); Rot4 random; do { random = Rot4.Random; }while (random == Find.World.CoastDirectionAt(map.Tile)); if (random == Rot4.North) { moduleBase2 = new Rotate(0.0, 90.0, 0.0, moduleBase2); moduleBase2 = new Translate(0.0, 0.0, (double)(-(double)map.Size.z), moduleBase2); } else if (random == Rot4.East) { moduleBase2 = new Translate((double)(-(double)map.Size.x), 0.0, 0.0, moduleBase2); } else if (random == Rot4.South) { moduleBase2 = new Rotate(0.0, 90.0, 0.0, moduleBase2); } else { //random == Rot4.West; } NoiseDebugUI.StoreNoiseRender(moduleBase2, "mountain"); moduleBase = new Add(moduleBase, moduleBase2); NoiseDebugUI.StoreNoiseRender(moduleBase, "elev + mountain"); } float b = map.TileInfo.WaterCovered ? 0f : float.MaxValue; MapGenFloatGrid elevation = MapGenerator.Elevation; foreach (IntVec3 intVec in map.AllCells) { elevation[intVec] = Mathf.Min(moduleBase.GetValue(intVec), b); } ModuleBase moduleBase3 = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High); moduleBase3 = new ScaleBias(0.5, 0.5, moduleBase3); NoiseDebugUI.StoreNoiseRender(moduleBase3, "noiseFert base"); MapGenFloatGrid fertility = MapGenerator.Fertility; foreach (IntVec3 intVec2 in map.AllCells) { fertility[intVec2] = moduleBase3.GetValue(intVec2); } }
public static bool Prefix(Map map) { //if (!DefsUtil.Enable) // return true; //if (!DefsUtil.EnableMountainSettings) // return true; if (Settings.detectedImpassableMaps && map.TileInfo.hilliness == Hilliness.Impassable) { return(true); } NoiseRenderer.renderSize = new IntVec2(map.Size.x, map.Size.z); ModuleBase input = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High); input = new ScaleBias(0.5, 0.5, input); NoiseDebugUI.StoreNoiseRender(input, "elev base"); float num = 1f; switch (map.TileInfo.hilliness) { case Hilliness.Flat: num = MapGenTuning.ElevationFactorFlat; break; case Hilliness.SmallHills: num = MapGenTuning.ElevationFactorSmallHills; break; case Hilliness.LargeHills: num = MapGenTuning.ElevationFactorLargeHills; break; case Hilliness.Mountainous: num = MapGenTuning.ElevationFactorMountains; break; case Hilliness.Impassable: num = MapGenTuning.ElevationFactorImpassableMountains; break; } input = new Multiply(input, new Const(num + MapSettings.Mountain.GetMultiplier())); NoiseDebugUI.StoreNoiseRender(input, "elev world-factored"); if (map.TileInfo.hilliness == Hilliness.Mountainous || map.TileInfo.hilliness == Hilliness.Impassable) { ModuleBase input2 = new DistFromAxis((float)map.Size.x * 0.42f); input2 = new Clamp(0.0, 1.0, input2); input2 = new Invert(input2); input2 = new ScaleBias(1.0, 1.0, input2); Rot4 random; do { random = Rot4.Random; }while (random == Find.World.CoastDirectionAt(map.Tile)); if (random == Rot4.North) { input2 = new Rotate(0.0, 90.0, 0.0, input2); input2 = new Translate(0.0, 0.0, -map.Size.z, input2); } else if (random == Rot4.East) { input2 = new Translate(-map.Size.x, 0.0, 0.0, input2); } else if (random == Rot4.South) { input2 = new Rotate(0.0, 90.0, 0.0, input2); } else { _ = random == Rot4.West; } NoiseDebugUI.StoreNoiseRender(input2, "mountain"); input = new Add(input, input2); NoiseDebugUI.StoreNoiseRender(input, "elev + mountain"); } float b = (map.TileInfo.WaterCovered ? 0f : float.MaxValue); MapGenFloatGrid elevation = MapGenerator.Elevation; foreach (IntVec3 allCell in map.AllCells) { elevation[allCell] = Mathf.Min(input.GetValue(allCell), b); } ModuleBase input3 = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High); input3 = new ScaleBias(0.5, 0.5, input3); NoiseDebugUI.StoreNoiseRender(input3, "noiseFert base"); MapGenFloatGrid fertility = MapGenerator.Fertility; foreach (IntVec3 allCell2 in map.AllCells) { fertility[allCell2] = input3.GetValue(allCell2); } return(false); }
public static void WorkOnMapGenerator(Map map) { ModExt_Biome_GenStep_Ravine extRavine = map.Biome.GetModExtension <ModExt_Biome_GenStep_Ravine>(); if (extRavine == null) { return; } string noiseLabel = "ravine " + map.Biome.defName; double xOffset = map.Size.x / 2; double zOffset = map.Size.z / 2; float baseWidth = Rand.Range(extRavine.ravineWidthMin, extRavine.ravineWidthMax); double modA = Rand.Range(extRavine.modAMin, extRavine.modAMax); double modB = Rand.Range(extRavine.modBMin, extRavine.modBMax); double modC = Rand.Range(extRavine.modCMin, extRavine.modCMax); // Base noise ModuleBase moduleBase = new DistFromAxis((float)map.Size.x * baseWidth); //NoiseDebugUI.StoreNoiseRender(moduleBase, noiseLabel + " base core"); moduleBase = new CurveAxis(modA, modB, modC, moduleBase); //NoiseDebugUI.StoreNoiseRender(moduleBase, noiseLabel + " base curved"); moduleBase = new ScaleBias(extRavine.slopeFactor, -1.0, moduleBase); //NoiseDebugUI.StoreNoiseRender(moduleBase, noiseLabel + " base scale"); if (extRavine.invert) { moduleBase = new Invert(moduleBase); } //NoiseDebugUI.StoreNoiseRender(moduleBase, noiseLabel + " base invert"); moduleBase = new Clamp(0.0, 999, moduleBase); //NoiseDebugUI.StoreNoiseRender(moduleBase, noiseLabel + " base clamp"); NoiseDebugUI.StoreNoiseRender(moduleBase, noiseLabel + " base"); // Add offset variance float offsetVariance = (Rand.Value - 0.5f) * extRavine.relativeOffsetVariance + extRavine.relativeOffsetFixed; xOffset += map.Size.x * offsetVariance; zOffset += map.Size.z * offsetVariance; // Add random rotation variance double rotVariance = (Rand.Value - 0.5f) * extRavine.rotationVariance; // Get overall ravine direction Rot4 random; do { random = Rot4.Random; }while (random == Find.World.CoastDirectionAt(map.Tile)); if (random == Rot4.North) { moduleBase = new Rotate(0.0, 270.0 + rotVariance, 0.0, moduleBase); moduleBase = new Translate(0.0, 0.0, zOffset, moduleBase); } else if (random == Rot4.West) { moduleBase = new Rotate(0.0, 180.0 + rotVariance, 0.0, moduleBase); moduleBase = new Translate(xOffset, 0.0, 0.0, moduleBase); } else if (random == Rot4.South) { moduleBase = new Rotate(0.0, 90.0 + rotVariance, 0.0, moduleBase); moduleBase = new Translate(0.0, 0.0, (-zOffset), moduleBase); } else if (random == Rot4.East) { moduleBase = new Rotate(0.0, 0.0 + rotVariance, 0.0, moduleBase); moduleBase = new Translate((-xOffset), 0.0, 0.0, moduleBase); } // Elevation noise scaling ModuleBase noiseElevation = new ScaleBias(extRavine.noiseElevationPreScale, extRavine.noiseElevationPreOffset, moduleBase); NoiseDebugUI.StoreNoiseRender(noiseElevation, noiseLabel + " elevation"); // Fertility noise scaling ModuleBase noiseFertility = new ScaleBias(extRavine.noiseFertilityPreScale, extRavine.noiseFertilityPreOffset, moduleBase); NoiseDebugUI.StoreNoiseRender(noiseFertility, noiseLabel + " fertility"); // Work on MapGenerator grid MapGenFloatGrid elevation = MapGenerator.Elevation; MapGenFloatGrid fertility = MapGenerator.Fertility; foreach (IntVec3 cell in map.AllCells) { // Set elevation if (extRavine.calcElevationType == GenStepCalculationType.Set) { elevation[cell] = noiseElevation.GetValue(cell) + extRavine.elevationPostOffset; } else if (extRavine.calcElevationType == GenStepCalculationType.Add) { elevation[cell] += noiseElevation.GetValue(cell) + extRavine.elevationPostOffset; } // Set fertility if (extRavine.calcFertilityType == GenStepCalculationType.Set) { fertility[cell] = noiseFertility.GetValue(cell) + extRavine.fertilityPostOffset; } else if (extRavine.calcFertilityType == GenStepCalculationType.Add) { fertility[cell] += noiseFertility.GetValue(cell) + extRavine.fertilityPostOffset; } } }
public override void Generate(Map map) { IntVec3 size = map.Size; int x = size.x; IntVec3 size2 = map.Size; NoiseRenderer.renderSize = new IntVec2(x, size2.z); ModuleBase input = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, 2147483647), QualityMode.High); input = new ScaleBias(0.5, 0.5, input); NoiseDebugUI.StoreNoiseRender(input, "elev base"); float num = 1f; switch (map.TileInfo.hilliness) { case Hilliness.Flat: num = MapGenTuning.ElevationFactorFlat; break; case Hilliness.SmallHills: num = MapGenTuning.ElevationFactorSmallHills; break; case Hilliness.LargeHills: num = MapGenTuning.ElevationFactorLargeHills; break; case Hilliness.Mountainous: num = MapGenTuning.ElevationFactorMountains; break; case Hilliness.Impassable: num = MapGenTuning.ElevationFactorImpassableMountains; break; } input = new Multiply(input, new Const((double)num)); NoiseDebugUI.StoreNoiseRender(input, "elev world-factored"); if (map.TileInfo.hilliness != Hilliness.Mountainous && map.TileInfo.hilliness != Hilliness.Impassable) { goto IL_02b1; } IntVec3 size3 = map.Size; ModuleBase input2 = new DistFromAxis((float)((float)size3.x * 0.41999998688697815)); input2 = new Clamp(0.0, 1.0, input2); input2 = new Invert(input2); input2 = new ScaleBias(1.0, 1.0, input2); Rot4 random; while (true) { random = Rot4.Random; if (!(random == Find.World.CoastDirectionAt(map.Tile))) { break; } } if (random == Rot4.North) { input2 = new Rotate(0.0, 90.0, 0.0, input2); IntVec3 size4 = map.Size; input2 = new Translate(0.0, 0.0, (double)(-size4.z), input2); } else if (random == Rot4.East) { IntVec3 size5 = map.Size; input2 = new Translate((double)(-size5.x), 0.0, 0.0, input2); } else if (random == Rot4.South) { input2 = new Rotate(0.0, 90.0, 0.0, input2); } else if (!(random == Rot4.West)) { goto IL_0291; } goto IL_0291; IL_0291: NoiseDebugUI.StoreNoiseRender(input2, "mountain"); input = new Add(input, input2); NoiseDebugUI.StoreNoiseRender(input, "elev + mountain"); goto IL_02b1; IL_02b1: float b = (float)((!map.TileInfo.WaterCovered) ? 3.4028234663852886E+38 : 0.0); MapGenFloatGrid elevation = MapGenerator.Elevation; foreach (IntVec3 allCell in map.AllCells) { elevation[allCell] = Mathf.Min(input.GetValue(allCell), b); } ModuleBase input3 = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, 2147483647), QualityMode.High); input3 = new ScaleBias(0.5, 0.5, input3); NoiseDebugUI.StoreNoiseRender(input3, "noiseFert base"); MapGenFloatGrid fertility = MapGenerator.Fertility; foreach (IntVec3 allCell2 in map.AllCells) { fertility[allCell2] = input3.GetValue(allCell2); } }
// Token: 0x0600003D RID: 61 RVA: 0x000033A0 File Offset: 0x000015A0 public override void Generate(Map map, GenStepParams parms) { NoiseRenderer.renderSize = new IntVec2(map.Size.x, map.Size.z); ModuleBase moduleBase = new Perlin(0.0209999997168779, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High); moduleBase = new ScaleBias(0.5, 0.5, moduleBase); NoiseDebugUI.StoreNoiseRender(moduleBase, "elev base"); float num = 1.8f; moduleBase = new Multiply(moduleBase, new Const((double)num)); NoiseDebugUI.StoreNoiseRender(moduleBase, "elev world-factored"); ModuleBase moduleBase2 = new DistFromAxis((float)map.Size.x * 0.42f); moduleBase2 = new Clamp(0.0, 1.0, moduleBase2); moduleBase2 = new Invert(moduleBase2); moduleBase2 = new ScaleBias(1.0, 1.0, moduleBase2); Rot4 random; do { random = Rot4.Random; }while (random == Find.World.CoastDirectionAt(map.Tile)); bool flag = random == Rot4.North; if (flag) { moduleBase2 = new Rotate(0.0, 90.0, 0.0, moduleBase2); moduleBase2 = new Translate(0.0, 0.0, -(double)map.Size.z, moduleBase2); } else { bool flag2 = random == Rot4.East; if (flag2) { moduleBase2 = new Translate(-(double)map.Size.x, 0.0, 0.0, moduleBase2); } else { bool flag3 = random == Rot4.South; if (flag3) { moduleBase2 = new Rotate(0.0, 90.0, 0.0, moduleBase2); } else { bool flag4 = random == Rot4.West; if (flag4) { } } } } NoiseDebugUI.StoreNoiseRender(moduleBase2, "mountain"); moduleBase = new Add(moduleBase, moduleBase2); NoiseDebugUI.StoreNoiseRender(moduleBase, "elev + mountain"); float num2 = (!map.TileInfo.WaterCovered) ? 3.402823E+38f : 0f; MapGenFloatGrid elevation = MapGenerator.Elevation; foreach (IntVec3 intVec in map.AllCells) { elevation[intVec] = Mathf.Min(moduleBase.GetValue(intVec), num2); } MapGenFloatGrid fertility = MapGenerator.Fertility; foreach (IntVec3 c in map.AllCells) { fertility[c] = 0f; } }