Move some stuff from HackyAI to new AIUtils
This commit is contained in:
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
if (waterState == Water.NotChecked)
|
||||
{
|
||||
if (ai.IsAreaAvailable<BaseProvider>(ai.Info.MaxBaseRadius, ai.Info.WaterTerrainTypes))
|
||||
if (AIUtils.IsAreaAvailable<BaseProvider>(ai.World, ai.Player, ai.Map, ai.Info.MaxBaseRadius, ai.Info.WaterTerrainTypes))
|
||||
waterState = Water.EnoughWater;
|
||||
else
|
||||
{
|
||||
@@ -259,7 +259,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
// Only consider building this if there is enough water inside the base perimeter and there are close enough adjacent buildings
|
||||
if (waterState == Water.EnoughWater && ai.Info.NewProductionCashThreshold > 0
|
||||
&& playerResources.Resources > ai.Info.NewProductionCashThreshold
|
||||
&& ai.IsAreaAvailable<GivesBuildableArea>(ai.Info.CheckForWaterRadius, ai.Info.WaterTerrainTypes))
|
||||
&& AIUtils.IsAreaAvailable<GivesBuildableArea>(ai.World, ai.Player, ai.Map, ai.Info.CheckForWaterRadius, ai.Info.WaterTerrainTypes))
|
||||
{
|
||||
var navalproduction = GetProducibleBuilding(ai.Info.BuildingCommonNames.NavalProduction, buildableThings);
|
||||
if (navalproduction != null && HasSufficientPowerForActor(navalproduction))
|
||||
@@ -313,7 +313,8 @@ namespace OpenRA.Mods.Common.AI
|
||||
// and any structure providing buildable area close enough to that water.
|
||||
// TODO: Extend this check to cover any naval structure, not just production.
|
||||
if (ai.Info.BuildingCommonNames.NavalProduction.Contains(name)
|
||||
&& (waterState == Water.NotEnoughWater || !ai.IsAreaAvailable<GivesBuildableArea>(ai.Info.CheckForWaterRadius, ai.Info.WaterTerrainTypes)))
|
||||
&& (waterState == Water.NotEnoughWater
|
||||
|| !AIUtils.IsAreaAvailable<GivesBuildableArea>(ai.World, ai.Player, ai.Map, ai.Info.CheckForWaterRadius, ai.Info.WaterTerrainTypes)))
|
||||
continue;
|
||||
|
||||
// Will this put us into low power?
|
||||
|
||||
Reference in New Issue
Block a user