diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs index 4e42412d26..7bdd60dba0 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs @@ -42,6 +42,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Tells the AI what building types are considered silos (resource storage).")] public readonly HashSet SiloTypes = new HashSet(); + [Desc("Tells the AI what building types are considered defenses.")] + public readonly HashSet DefenseTypes = new HashSet(); + [Desc("Production queues AI uses for buildings.")] public readonly HashSet BuildingQueues = new HashSet { "Building" }; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs index 67e7c03d2e..e5022821a1 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs @@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Traits else { // Check if Building is a defense and if we should place it towards the enemy or not. - if (actorInfo.HasTraitInfo() && world.LocalRandom.Next(100) < baseBuilder.Info.PlaceDefenseTowardsEnemyChance) + if (baseBuilder.Info.DefenseTypes.Contains(actorInfo.Name) && world.LocalRandom.Next(100) < baseBuilder.Info.PlaceDefenseTowardsEnemyChance) type = BuildingType.Defense; else if (baseBuilder.Info.RefineryTypes.Contains(actorInfo.Name)) type = BuildingType.Refinery; diff --git a/mods/cnc/rules/ai.yaml b/mods/cnc/rules/ai.yaml index 64b9eb0974..7d569178db 100644 --- a/mods/cnc/rules/ai.yaml +++ b/mods/cnc/rules/ai.yaml @@ -97,6 +97,7 @@ Player: VehiclesFactoryTypes: weap, afld ProductionTypes: pyle, hand, weap, afld, hpad SiloTypes: silo + DefenseTypes: gtwr,gun,atwr,obli,sam BuildingLimits: proc: 4 pyle: 3 @@ -140,6 +141,7 @@ Player: VehiclesFactoryTypes: weap,afld ProductionTypes: pyle,hand,weap,afld,hpad SiloTypes: silo + DefenseTypes: gtwr,gun,atwr,obli,sam BuildingLimits: proc: 4 pyle: 3 @@ -183,6 +185,7 @@ Player: VehiclesFactoryTypes: weap,afld ProductionTypes: pyle,hand,weap,afld,hpad SiloTypes: silo + DefenseTypes: gtwr,gun,atwr,obli,sam BuildingLimits: proc: 4 pyle: 4 diff --git a/mods/d2k/rules/ai.yaml b/mods/d2k/rules/ai.yaml index 273a78be93..517952a6ed 100644 --- a/mods/d2k/rules/ai.yaml +++ b/mods/d2k/rules/ai.yaml @@ -78,6 +78,7 @@ Player: VehiclesFactoryTypes: light_factory, heavy_factory, starport ProductionTypes: light_factory, heavy_factory, barracks, starport SiloTypes: silo + DefenseTypes: medium_gun_turret,large_gun_turret BuildingLimits: barracks: 1 refinery: 4 @@ -128,6 +129,7 @@ Player: VehiclesFactoryTypes: light_factory, heavy_factory, starport ProductionTypes: light_factory, heavy_factory, barracks, starport SiloTypes: silo + DefenseTypes: medium_gun_turret,large_gun_turret BuildingLimits: barracks: 1 refinery: 4 @@ -178,6 +180,7 @@ Player: VehiclesFactoryTypes: light_factory, heavy_factory, starport ProductionTypes: light_factory, heavy_factory, barracks, starport SiloTypes: silo + DefenseTypes: medium_gun_turret,large_gun_turret BuildingLimits: barracks: 1 refinery: 4 diff --git a/mods/ra/rules/ai.yaml b/mods/ra/rules/ai.yaml index 37e15b1f1d..9c7a983ce0 100644 --- a/mods/ra/rules/ai.yaml +++ b/mods/ra/rules/ai.yaml @@ -91,6 +91,7 @@ Player: VehiclesFactoryTypes: weap ProductionTypes: barr,tent,weap SiloTypes: silo + DefenseTypes: hbox,pbox,gun,ftur,tsla,agun,sam BuildingLimits: proc: 4 barr: 1 @@ -133,6 +134,7 @@ Player: ProductionTypes: barr,tent,weap,afld,hpad NavalProductionTypes: spen, syrd SiloTypes: silo + DefenseTypes: hbox,pbox,gun,ftur,tsla,agun,sam BuildingLimits: proc: 4 barr: 1 @@ -184,6 +186,7 @@ Player: ProductionTypes: barr,tent,weap,afld,hpad NavalProductionTypes: spen, syrd SiloTypes: silo + DefenseTypes: hbox,pbox,gun,ftur,tsla,agun,sam BuildingLimits: proc: 4 barr: 1 @@ -236,6 +239,7 @@ Player: ProductionTypes: barr,tent,weap,afld,hpad NavalProductionTypes: spen, syrd SiloTypes: silo + DefenseTypes: hbox,pbox,gun,ftur,tsla,agun,sam BuildingLimits: proc: 4 dome: 1 diff --git a/mods/ts/rules/ai.yaml b/mods/ts/rules/ai.yaml index 4a0e1b91f9..8f0b8f31eb 100644 --- a/mods/ts/rules/ai.yaml +++ b/mods/ts/rules/ai.yaml @@ -22,6 +22,7 @@ Player: VehiclesFactoryTypes: gaweap, naweap ProductionTypes: gapile, nahand, gaweap, naweap, gahpad, nahpad SiloTypes: gasilo + DefenseTypes: gavulc,garock,gacsam,gactwr,naobel,nalasr,nasam BuildingLimits: proc: 4 gasilo: 2