Fix HackyAI trying to deploy undeployable actors
This commit is contained in:
@@ -979,12 +979,16 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
if (!mcv.IsIdle)
|
if (!mcv.IsIdle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Don't try to move and deploy an undeployable actor
|
||||||
|
var transformsInfo = mcv.Info.TraitInfoOrDefault<TransformsInfo>();
|
||||||
|
if (transformsInfo == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
// If we lack a base, we need to make sure we don't restrict deployment of the MCV to the base!
|
// If we lack a base, we need to make sure we don't restrict deployment of the MCV to the base!
|
||||||
var restrictToBase =
|
var restrictToBase = Info.RestrictMCVDeploymentFallbackToBase &&
|
||||||
Info.RestrictMCVDeploymentFallbackToBase &&
|
|
||||||
CountBuildingByCommonName(Info.BuildingCommonNames.ConstructionYard, Player) > 0;
|
CountBuildingByCommonName(Info.BuildingCommonNames.ConstructionYard, Player) > 0;
|
||||||
var factType = mcv.Info.TraitInfo<TransformsInfo>().IntoActor;
|
|
||||||
var desiredLocation = ChooseBuildLocation(factType, restrictToBase, BuildingType.Building);
|
var desiredLocation = ChooseBuildLocation(transformsInfo.IntoActor, restrictToBase, BuildingType.Building);
|
||||||
if (desiredLocation == null)
|
if (desiredLocation == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user