diff --git a/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs index c035738730..372c906def 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs @@ -118,7 +118,8 @@ namespace OpenRA.Mods.Common.Traits if (unitBuilder != null) { var mcvInfo = AIUtils.GetInfoByCommonName(Info.McvTypes, player); - unitBuilder.RequestUnitProduction(bot, mcvInfo.Name); + if (unitBuilder.RequestedProductionCount(bot, mcvInfo.Name) == 0) + unitBuilder.RequestUnitProduction(bot, mcvInfo.Name); } } } diff --git a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs index ca9bf31fdf..eb5137d195 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs @@ -9,8 +9,6 @@ */ #endregion -using System; -using System.Collections; using System.Collections.Generic; using System.Linq; using OpenRA.Traits; @@ -96,6 +94,11 @@ namespace OpenRA.Mods.Common.Traits queuedBuildRequests.Add(requestedActor); } + int IBotRequestUnitProduction.RequestedProductionCount(IBot bot, string requestedActor) + { + return queuedBuildRequests.Count(r => r == requestedActor); + } + void BuildUnit(IBot bot, string category, bool buildRandom) { // Pick a free queue diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 6a4df6063f..63bc6ee49b 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -472,6 +472,7 @@ namespace OpenRA.Mods.Common.Traits public interface IBotRequestUnitProduction { void RequestUnitProduction(IBot bot, string requestedActor); + int RequestedProductionCount(IBot bot, string requestedActor); } [RequireExplicitImplementation]