Implement Building/UnitDelays
This commit is contained in:
committed by
reaperrr
parent
2a9721a9f8
commit
2aebb05cd0
@@ -33,6 +33,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("What units should the AI have a maximum limit to train.")]
|
||||
public readonly Dictionary<string, int> UnitLimits = null;
|
||||
|
||||
[Desc("When should the AI start train specific units.")]
|
||||
public readonly Dictionary<string, int> UnitDelays = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new UnitBuilderBotModule(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -118,6 +121,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.UnitsToBuild != null && !Info.UnitsToBuild.ContainsKey(name))
|
||||
return;
|
||||
|
||||
if (Info.UnitDelays != null &&
|
||||
Info.UnitDelays.ContainsKey(name) &&
|
||||
Info.UnitDelays[name] > world.WorldTick)
|
||||
return;
|
||||
|
||||
if (Info.UnitLimits != null &&
|
||||
Info.UnitLimits.ContainsKey(name) &&
|
||||
world.Actors.Count(a => a.Owner == player && a.Info.Name == name) >= Info.UnitLimits[name])
|
||||
|
||||
Reference in New Issue
Block a user