private void DoTerrainChangedEffects(IntVec3 c) { map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Terrain, regenAdjacentCells: true, regenAdjacentSections: false); List <Thing> thingList = c.GetThingList(map); for (int num = thingList.Count - 1; num >= 0; num--) { if (thingList[num].def.category == ThingCategory.Plant && map.fertilityGrid.FertilityAt(c) < thingList[num].def.plant.fertilityMin) { thingList[num].Destroy(); } else if (thingList[num].def.category == ThingCategory.Filth && !FilthMaker.TerrainAcceptsFilth(TerrainAt(c), thingList[num].def)) { thingList[num].Destroy(); } else if ((thingList[num].def.IsBlueprint || thingList[num].def.IsFrame) && !GenConstruct.CanBuildOnTerrain(thingList[num].def.entityDefToBuild, thingList[num].Position, map, thingList[num].Rotation, null, ((IConstructible)thingList[num]).EntityToBuildStuff())) { thingList[num].Destroy(DestroyMode.Cancel); } } map.pathGrid.RecalculatePerceivedPathCostAt(c); if (drawerInt != null) { drawerInt.SetDirty(); } map.fertilityGrid.Drawer.SetDirty(); Region regionAt_NoRebuild_InvalidAllowed = map.regionGrid.GetRegionAt_NoRebuild_InvalidAllowed(c); if (regionAt_NoRebuild_InvalidAllowed != null && regionAt_NoRebuild_InvalidAllowed.Room != null) { regionAt_NoRebuild_InvalidAllowed.Room.Notify_TerrainChanged(); } }