diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 16bde81d4a..e003086171 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -101,6 +101,9 @@ namespace OpenRA.Mods.Common.AI [Desc("Radius in cells around a factory scanned for rally points by the AI.")] public readonly int RallyPointScanRadius = 8; + [Desc("Minimum distance in cells from center of the base when checking for building placement.")] + public readonly int MinBaseRadius = 2; + [Desc("Radius in cells around the center of the base to expand.")] public readonly int MaxBaseRadius = 20; @@ -501,22 +504,22 @@ namespace OpenRA.Mods.Common.AI case BuildingType.Refinery: // Try and place the refinery near a resource field - var nearbyResources = Map.FindTilesInCircle(baseCenter, Info.MaxBaseRadius) + var nearbyResources = Map.FindTilesInAnnulus(baseCenter, Info.MinBaseRadius, Info.MaxBaseRadius) .Where(a => resourceTypeIndices.Get(Map.GetTerrainIndex(a))) .Shuffle(Random).Take(Info.MaxResourceCellsToCheck); foreach (var r in nearbyResources) { - var found = findPos(r, baseCenter, 0, Info.MaxBaseRadius); + var found = findPos(r, baseCenter, Info.MinBaseRadius, Info.MaxBaseRadius); if (found != null) return found; } // Try and find a free spot somewhere else in the base - return findPos(baseCenter, baseCenter, 0, Info.MaxBaseRadius); + return findPos(baseCenter, baseCenter, Info.MinBaseRadius, Info.MaxBaseRadius); case BuildingType.Building: - return findPos(baseCenter, baseCenter, 0, distanceToBaseIsImportant ? Info.MaxBaseRadius : Map.MaxTilesInCircleRange); + return findPos(baseCenter, baseCenter, Info.MinBaseRadius, distanceToBaseIsImportant ? Info.MaxBaseRadius : Map.MaxTilesInCircleRange); } // Can't find a build location