Add NewProductionChance so bot won't only build production when too much cash
This commit is contained in:
committed by
Gustas Kažukauskas
parent
9478548bdb
commit
62e692063a
@@ -110,6 +110,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Try to build another production building if there is too much cash.")]
|
||||
public readonly int NewProductionCashThreshold = 5000;
|
||||
|
||||
[Desc("Chance to build another production building if there is too much cash.")]
|
||||
public readonly int NewProductionChance = 50;
|
||||
|
||||
[Desc("Radius in cells around a factory scanned for rally points by the AI.")]
|
||||
public readonly int RallyPointScanRadius = 8;
|
||||
|
||||
|
||||
@@ -321,7 +321,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// Make sure that we can spend as fast as we are earning
|
||||
if (baseBuilder.Info.NewProductionCashThreshold > 0 && playerResources.GetCashAndResources() > baseBuilder.Info.NewProductionCashThreshold)
|
||||
if (baseBuilder.Info.NewProductionCashThreshold > 0 && playerResources.GetCashAndResources() > baseBuilder.Info.NewProductionCashThreshold
|
||||
&& world.LocalRandom.Next(100) < baseBuilder.Info.NewProductionChance)
|
||||
{
|
||||
var production = GetProducibleBuilding(baseBuilder.Info.ProductionTypes, buildableThings);
|
||||
if (production != null && HasSufficientPowerForActor(production))
|
||||
|
||||
Reference in New Issue
Block a user