public static void Postifx(ref float __result, WorldGrid __instance, ref int fromTile, ref int toTile, ref StringBuilder explanation) { List <Tile.RoadLink> roads = __instance.tiles[fromTile].Roads; if (roads == null) { return; } if (toTile == -1) { toTile = __instance.FindMostReasonableAdjacentTileForDisplayedPathCost(fromTile); } float BiomeModifier = 0; float HillModifier = 0; float WinterModifier = 0; for (int i = 0; i < roads.Count; i++) { if (roads[i].neighbor == toTile) { Tile ToTileAsTile = Find.WorldGrid[toTile]; float HillinessOffset = (float)HillinessMovementDifficultyOffset.Invoke(null, new object[] { ToTileAsTile.hilliness }); if (HillinessOffset > 12f) { HillinessOffset = 12f; } // If the tile has an impassable biome, set the biomemovement difficulty to 12, as per the patch for CalculatedMovementDifficultyAt float biomeMovementDifficulty = (ToTileAsTile.biome.impassable ? 12f : ToTileAsTile.biome.movementDifficulty); // Calculate biome, Hillines & winter modifiers, update explanation & multiply result by biome modifier float RoadModifier = RoadsOfTheRim.calculateRoadModifier( roads[i].road, biomeMovementDifficulty, HillinessOffset, WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(toTile), out BiomeModifier, out HillModifier, out WinterModifier ); float resultBefore = __result; __result *= RoadModifier; if (explanation != null) { explanation.AppendLine(); explanation.Append(String.Format( "The road cancels {0:P0} of the biome ({3:##.###}), {1:P0} of the hills ({4:##.###}) & {2:P0} of winter movement costs. Total modifier={5} applied to {6}", BiomeModifier, HillModifier, WinterModifier, biomeMovementDifficulty, HillinessOffset, RoadModifier, resultBefore )); } return; } } }