public static bool Generate_PreFix(Map map, GenStep_Caves __instance)
        {
            Traverse   traverseobj    = Traverse.Create(__instance);
            ModuleBase directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);

            //Log.Error("patching");
            if (map.Biome.defName == "RWBCavern")
            {
                GenStep_Cavern test = new GenStep_Cavern();
                test.Generate(map);
                return(false);
            }
            return(true);
        }
        public static bool Generate_PreFix(Map map, GenStep_Caves __instance)
        {
            Traverse   traverseobj    = Traverse.Create(__instance);
            ModuleBase directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);

            //Log.Error("patching");
            if (map.Biome.defName == "RWBCavern")
            {
                GenStep_Cavern test = new GenStep_Cavern();
                test.Generate(map);
                //test.Generate(map);
                //MapGenFloatGrid elevation = MapGenerator.Elevation;
                //BoolGrid visited = new BoolGrid(map);
                //List<IntVec3> group = new List<IntVec3>();
                //foreach (IntVec3 current in map.AllCells)
                //{
                //	if (!visited[current] && IsRock(current, elevation, map))
                //	{
                //		group.Clear();
                //		map.floodFiller.FloodFill(current, (IntVec3 x) => IsRock(x, elevation, map), delegate (IntVec3 x)
                //		{
                //			visited[x] = true;
                //			group.Add(x);
                //		}, 2147483647, false, null);
                //		Trim(group, map);

                //		RemoveSmallDisconnectedSubGroups(group, map);

                //		if (group.Count >= 300)
                //		{
                //			DoOpenTunnels(group, map, __instance);
                //			DoClosedTunnels(group, map, __instance);
                //		}
                //	}
                //}
                return(false);
            }
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Generate a minimal map with elevation and fertility grids
        /// </summary>
        private static MapGridSet GenerateMapGrids(int mapTile, int mapSize, bool revealCaves)
        {
            DeepProfiler.Start("generateMapPreviewGrids");
            try {
                Rand.PushState();
                var mapGeneratorData = (Dictionary <string, object>)ReflectionCache.MapGenerator_Data.GetValue(null);
                mapGeneratorData.Clear();

                var map = CreateMapStub(mapSize, mapTile);
                MapGenerator.mapBeingGenerated = map;

                var mapSeed = Gen.HashCombineInt(Find.World.info.Seed, map.Tile);
                Rand.Seed = mapSeed;
                RockNoises.Init(map);

                var elevationFertilityGenstep = new GenStep_ElevationFertility();
                Rand.Seed = Gen.HashCombineInt(mapSeed, elevationFertilityGenstep.SeedPart);
                elevationFertilityGenstep.Generate(map, new GenStepParams());

                if (revealCaves)
                {
                    var cavesGenstep = new GenStep_Caves();
                    Rand.Seed = Gen.HashCombineInt(mapSeed, cavesGenstep.SeedPart);
                    cavesGenstep.Generate(map, new GenStepParams());
                }

                var result = new MapGridSet(MapGenerator.Elevation, MapGenerator.Fertility, MapGenerator.Caves, map);
                mapGeneratorData.Clear();

                return(result);
            } finally {
                DeepProfiler.End();
                MapGenerator.mapBeingGenerated = null;
                Rand.PopState();
            }
        }