Merge pull request #11463 from reaperrr/fix-ai-mcv

Improve AI MCV deployment
This commit is contained in:
reaperrr
2016-06-30 11:44:14 +02:00
committed by GitHub

View File

@@ -125,6 +125,9 @@ namespace OpenRA.Mods.Common.AI
[Desc("Radius in cells around the center of the base to expand.")]
public readonly int MaxBaseRadius = 20;
[Desc("Should deployment of additional MCVs be restricted to MaxBaseRadius if explicit deploy locations are missing or occupied?")]
public readonly bool RestrictMCVDeploymentFallbackToBase = true;
[Desc("Radius in cells around each building with ProvideBuildableArea",
"to check for a 3x3 area of water where naval structures can be built.",
"Should match maximum adjacency of naval structures.")]
@@ -817,7 +820,7 @@ namespace OpenRA.Mods.Common.AI
}
// Find any newly constructed MCVs and deploy them at a sensible
// backup location within the main base.
// backup location.
void FindAndDeployBackupMcv(Actor self)
{
var mcvs = self.World.Actors.Where(a => a.Owner == Player &&
@@ -825,12 +828,11 @@ namespace OpenRA.Mods.Common.AI
foreach (var mcv in mcvs)
{
var mover = mcv.TraitOrDefault<IMove>();
if (mover != null && mover.IsMoving)
if (!mcv.IsIdle)
continue;
var factType = mcv.Info.TraitInfo<TransformsInfo>().IntoActor;
var desiredLocation = ChooseBuildLocation(factType, false, BuildingType.Building);
var desiredLocation = ChooseBuildLocation(factType, Info.RestrictMCVDeploymentFallbackToBase, BuildingType.Building);
if (desiredLocation == null)
continue;