move SpeedUp to ClassicProductionQueueInfo
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user