Prevent unit requests from stacking during production.
This commit is contained in:
@@ -118,6 +118,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (unitBuilder != null)
|
||||
{
|
||||
var mcvInfo = AIUtils.GetInfoByCommonName(Info.McvTypes, player);
|
||||
if (unitBuilder.RequestedProductionCount(bot, mcvInfo.Name) == 0)
|
||||
unitBuilder.RequestUnitProduction(bot, mcvInfo.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user