move SpeedUp to ClassicProductionQueueInfo

This commit is contained in:
Matthias Mailänder
2013-02-09 12:26:09 +01:00
parent ecd4ff68a4
commit 527790f962
2 changed files with 14 additions and 7 deletions

View File

@@ -18,13 +18,21 @@ namespace OpenRA.Mods.RA
{
public class ClassicProductionQueueInfo : ProductionQueueInfo, Requires<TechTreeInfo>, Requires<PowerManagerInfo>, Requires<PlayerResourcesInfo>
{
public readonly float SpeedUp = 0;
public readonly float MaxSpeedUp = 0;
public override object Create(ActorInitializer init) { return new ClassicProductionQueue(init.self, this); }
}
public class ClassicProductionQueue : ProductionQueue, ISync
{
public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info )
: base(self, self, info) {}
public new ClassicProductionQueueInfo Info;
public ClassicProductionQueue(Actor self, ClassicProductionQueueInfo info)
: base(self, self, info)
{
this.Info = info;
}
[Sync] bool isActive = false;
@@ -86,8 +94,10 @@ namespace OpenRA.Mods.RA
.Where(p => p.Trait.Info.Produces.Contains(unit.Traits.Get<BuildableInfo>().Queue))
.Where(p => p.Actor.Owner == self.Owner).ToArray();
var speedUp = 1 - (selfsameBuildings.First().Trait.Info.SpeedUp * (selfsameBuildings.Count() - 1))
.Clamp(0, selfsameBuildings.First().Trait.Info.MaxSpeedUp);
var selfsameQueue = Rules.Info["player"].Traits.WithInterface<ClassicProductionQueueInfo>()
.First(p => selfsameBuildings.First().Trait.Info.Produces.Contains(p.Type));
var speedUp = 1 - (selfsameQueue.SpeedUp * (selfsameBuildings.Count() - 1)).Clamp(0, selfsameQueue.MaxSpeedUp);
var time = cost
* Info.BuildSpeed

View File

@@ -22,9 +22,6 @@ namespace OpenRA.Mods.RA
{
public readonly string[] Produces = { };
public readonly float SpeedUp = 0;
public readonly float MaxSpeedUp = 0;
public virtual object Create(ActorInitializer init) { return new Production(this); }
}