From abc3a79330ac3dc4ecd28099509cbbf7ee679dfc Mon Sep 17 00:00:00 2001 From: michaeldgg2 <119738087+michaeldgg2@users.noreply.github.com> Date: Sat, 14 Jun 2025 16:57:47 +0200 Subject: [PATCH] ResourceLayer: use BuildingInfo.TerrainTypes to check, if a resource can be placed underneath the building --- OpenRA.Mods.Common/Traits/World/ResourceLayer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs index bdd03a0471..16d7cbd0d6 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs @@ -172,10 +172,11 @@ namespace OpenRA.Mods.Common.Traits if (resourceType == null || !info.ResourceTypes.TryGetValue(resourceType, out var resourceInfo)) return false; - if (!resourceInfo.AllowedTerrainTypes.Contains(Map.GetTerrainInfo(cell).Type)) + var cellTerrainType = Map.GetTerrainInfo(cell).Type; + if (!resourceInfo.AllowedTerrainTypes.Contains(cellTerrainType)) return false; - return !BuildingInfluence.AnyBuildingAt(cell); + return BuildingInfluence.GetBuildingsAt(cell).All(a => a.Info.TraitInfo().TerrainTypes.Contains(cellTerrainType)); } ResourceLayerContents CreateResourceCell(string resourceType, CPos cell, int density)