Unhardcode AI air units and exclude scripted aircraft.
This commit is contained in:
committed by
reaperrr
parent
00ece1ba55
commit
e82aa9977e
@@ -24,6 +24,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Actor types that are valid for naval squads.")]
|
||||
public readonly HashSet<string> NavalUnitsTypes = new HashSet<string>();
|
||||
|
||||
[Desc("Actor types that are excluded from ground attacks.")]
|
||||
public readonly HashSet<string> AirUnitsTypes = new HashSet<string>();
|
||||
|
||||
[Desc("Actor types that should generally be excluded from attack squads.")]
|
||||
public readonly HashSet<string> ExcludeFromSquadsTypes = new HashSet<string>();
|
||||
|
||||
@@ -257,7 +260,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var a in newUnits)
|
||||
{
|
||||
if (a.Info.HasTraitInfo<AircraftInfo>() && a.Info.HasTraitInfo<AttackBaseInfo>())
|
||||
if (Info.AirUnitsTypes.Contains(a.Info.Name))
|
||||
{
|
||||
var air = GetSquadOfType(SquadType.Air);
|
||||
if (air == null)
|
||||
@@ -307,10 +310,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var allEnemyBaseBuilder = AIUtils.FindEnemiesByCommonName(Info.ConstructionYardTypes, Player);
|
||||
|
||||
// TODO: This should use common names & ExcludeFromSquads instead of hardcoding TraitInfo checks
|
||||
var ownUnits = activeUnits
|
||||
.Where(unit => unit.IsIdle && unit.Info.HasTraitInfo<AttackBaseInfo>()
|
||||
&& !unit.Info.HasTraitInfo<AircraftInfo>() && !Info.NavalUnitsTypes.Contains(unit.Info.Name) && !unit.Info.HasTraitInfo<HarvesterInfo>()).ToList();
|
||||
&& !Info.AirUnitsTypes.Contains(unit.Info.Name) && !Info.NavalUnitsTypes.Contains(unit.Info.Name) && !Info.ExcludeFromSquadsTypes.Contains(unit.Info.Name)).ToList();
|
||||
|
||||
if (!allEnemyBaseBuilder.Any() || ownUnits.Count < Info.SquadSize)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user