public static void UpdateTileByBiomeModExts(Tile tile) { // Module replacement ModExt_Biome_Replacement extReplacement = tile.biome.GetModExtension <ModExt_Biome_Replacement>(); if (extReplacement != null) { // Replace elevation if (extReplacement.replaceElevation) { tile.elevation = Rand.RangeInclusive(extReplacement.elevationMin, extReplacement.elevationMax); } // Replace hilliness if (extReplacement.replaceHilliness != null) { tile.hilliness = (Hilliness)extReplacement.replaceHilliness; } } // Module temperature ModExt_Biome_Temperature extTemperature = tile.biome.GetModExtension <ModExt_Biome_Temperature>(); if (extTemperature != null) { // Adjust base temperature tile.temperature = tile.temperature * (1f - extTemperature.tempStableWeight) + extTemperature.tempStableValue * extTemperature.tempStableWeight + extTemperature.tempOffset; } }
public static void Postfix(ref TerrainDef __result, IntVec3 c, Map map) { BiomeDef biome = map.Biome; // General cell terrain replcement ModExt_Biome_Replacement extReplacement = biome.GetModExtension <ModExt_Biome_Replacement>() ?? ModExt_Biome_Replacement.Default; // Replace sand (mostly from beach) if (__result == RimWorld.TerrainDefOf.Sand) { __result = extReplacement.sandReplacement; } // Replace gravel if (__result == RimWorld.TerrainDefOf.Gravel) { __result = extReplacement.gravelReplacement; } // Addtitional island terrainPatchMaker by fertility if (biome.HasModExtension <ModExt_Biome_GenStep_Islands>()) { TerrainDef newTerrain = IslandNoises.TerrainAtFromTerrainPatchMakerByFertility(c, map, __result); if (newTerrain != null) { __result = newTerrain; } } // Post-terrain-gen terrain replacement // Replace filler stone if (__result == TerrainDefOf.FillerStone) { __result = GenStep_RocksFromGrid.RockDefAt(c).building.naturalTerrain; } }