diff --git a/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs b/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs index e571a73083..5ac636d1ce 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs @@ -93,7 +93,8 @@ namespace OpenRA.Mods.D2k.Traits.Buildings // Fill the footprint with random variants foreach (var c in info.Tiles(self.Location)) { - if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue) + // Only place on allowed terrain types + if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue || !info.TerrainTypes.Contains(map.GetTerrainInfo(c).Type)) continue; // Don't place under other buildings (or their bib) @@ -109,7 +110,9 @@ namespace OpenRA.Mods.D2k.Traits.Buildings for (var i = 0; i < template.TilesCount; i++) { var c = self.Location + new CVec(i % template.Size.X, i / template.Size.X); - if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue) + + // Only place on allowed terrain types + if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue || !info.TerrainTypes.Contains(map.GetTerrainInfo(c).Type)) continue; // Don't place under other buildings (or their bib)