protected override void ChangeTileAfterSuccessfulDig(Tile tile, bool end) { if (Rand.Value < BiomeChangeChance) { tile.biome = BiomeDefOf.TundraSkerries; GenWorldGen.UpdateTileByBiomeModExts(tile); } }
public override void GenerateFresh(string seed) { // Get list of biomes and filter for only ones with special worker List<BiomeDef> biomes = DefDatabase<BiomeDef>.AllDefsListForReading; List<BiomeDef> specialBiomes = new List<BiomeDef>(); for (int i = biomes.Count - 1; i >= 0; i--) { if (biomes[i].WorkerSpecial() != null) { specialBiomes.Add(biomes[i]); // Reset/init chance algorithm for world generation biomes[i].WorkerSpecial().ResetChance(); } } // Apply special biome workers to tiles WorldGrid grid = Find.WorldGrid; List<Tile> tiles = grid.tiles; int tilesCount = grid.TilesCount; for (int i = 0; i < tilesCount; i++) { // Skip this tile if it already contains a special biome if (specialBiomes.Contains(tiles[i].biome)) { continue; } // Check all special biome defs if this tiles biome should be converted into a new biome foreach (BiomeDef biome in specialBiomes) { BiomeWorkerSpecial worker = biome.WorkerSpecial(); Tile currTile = tiles[i]; if (worker.PreRequirements(currTile) && worker.TryGenerateByChance()) { // Update biome and biome data via mod extensions currTile.biome = biome; GenWorldGen.UpdateTileByBiomeModExts(currTile); // Apply post generation effects (e.g. change more surrounding tiles) worker.PostGeneration(i); } } } // Change hilliness around caves to make them appear deeper in mountains for (int i = 0; i < tilesCount; i++) { Tile currTile = tiles[i]; if (currTile.biome == BiomeDefOf.CaveOasis || currTile.biome == BiomeDefOf.TunnelworldCave) { List<BiomeDef> excludeBiomes = new List<BiomeDef>(specialBiomes); excludeBiomes.Add(RimWorld.BiomeDefOf.SeaIce); excludeBiomes.Add(RimWorld.BiomeDefOf.Lake); excludeBiomes.Add(RimWorld.BiomeDefOf.Ocean); MakeImpassableHillsAroundTile(grid, i, excludeBiomes, 1); } } }
protected override void ChangeTileAfterSuccessfulDig(Tile tile, bool end) { if (Rand.Value < BiomeChangeChance) { if (Rand.Value < ArchipelagoBiomeChance) { tile.biome = BiomeDefOf.Archipelago; } else { tile.biome = BiomeDefOf.VolcanicIsland; } GenWorldGen.UpdateTileByBiomeModExts(tile); } }
protected override void ChangeTileAfterSuccessfulDig(Tile tile, bool end) { float randVal = Rand.Value; if (randVal < OasisBiomeChance || end) { tile.biome = BiomeDefOf.CaveOasis; } else if (randVal < TunnelBiomeChance) { tile.biome = BiomeDefOf.TunnelworldCave; } else { tile.biome = BiomeDefOf.CaveEntrance; } GenWorldGen.UpdateTileByBiomeModExts(tile); }
public static void Postfix(ref Tile __result) { GenWorldGen.UpdateTileByBiomeModExts(__result); }
protected override void ChangeTileAfterSuccessfulDig(Tile tile, bool end) { tile.biome = BiomeDefOf.InfestedMountains; GenWorldGen.UpdateTileByBiomeModExts(tile); }
protected override void ChangeTileAfterSuccessfulDig(Tile tile, bool end) { tile.biome = BiomeDefOf.DeepRavine; GenWorldGen.UpdateTileByBiomeModExts(tile); }