ResourceLayer: use BuildingInfo.TerrainTypes to check, if a resource can be placed underneath the building
This commit is contained in:
committed by
Gustas Kažukauskas
parent
25571df2b6
commit
abc3a79330
@@ -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<BuildingInfo>().TerrainTypes.Contains(cellTerrainType));
|
||||
}
|
||||
|
||||
ResourceLayerContents CreateResourceCell(string resourceType, CPos cell, int density)
|
||||
|
||||
Reference in New Issue
Block a user