Added ExcludeFromSquads to HackyAI

This commit is contained in:
Bynnar18
2016-06-24 06:25:52 -05:00
parent f0d6334697
commit dace814829

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.AI
public class UnitCategories
{
public readonly HashSet<string> Mcv = new HashSet<string>();
public readonly HashSet<string> ExcludeFromSquads = new HashSet<string>();
}
public class BuildingCategories
@@ -150,7 +151,7 @@ namespace OpenRA.Mods.Common.AI
[Desc("What buildings to the AI should build.", "What % of the total base must be this type of building.")]
public readonly Dictionary<string, float> BuildingFractions = null;
[Desc("Tells the AI what unit types fall under the same common name. Only supported entry is Mcv.")]
[Desc("Tells the AI what unit types fall under the same common name. Supported entries are Mcv and ExcludeFromSquads.")]
[FieldLoader.LoadUsing("LoadUnitCategories", true)]
public readonly UnitCategories UnitsCommonNames;
@@ -678,7 +679,8 @@ namespace OpenRA.Mods.Common.AI
void FindNewUnits(Actor self)
{
var newUnits = self.World.ActorsHavingTrait<IPositionable>()
.Where(a => a.Owner == Player && !Info.UnitsCommonNames.Mcv.Contains(a.Info.Name) && !activeUnits.Contains(a));
.Where(a => a.Owner == Player && !Info.UnitsCommonNames.Mcv.Contains(a.Info.Name) &&
!Info.UnitsCommonNames.ExcludeFromSquads.Contains(a.Info.Name) && !activeUnits.Contains(a));
foreach (var a in newUnits)
{