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 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 override object Create(ActorInitializer init) { return new ClassicProductionQueue(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ClassicProductionQueue : ProductionQueue, ISync
|
public class ClassicProductionQueue : ProductionQueue, ISync
|
||||||
{
|
{
|
||||||
public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info )
|
public new ClassicProductionQueueInfo Info;
|
||||||
: base(self, self, info) {}
|
|
||||||
|
public ClassicProductionQueue(Actor self, ClassicProductionQueueInfo info)
|
||||||
|
: base(self, self, info)
|
||||||
|
{
|
||||||
|
this.Info = info;
|
||||||
|
}
|
||||||
|
|
||||||
[Sync] bool isActive = false;
|
[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.Trait.Info.Produces.Contains(unit.Traits.Get<BuildableInfo>().Queue))
|
||||||
.Where(p => p.Actor.Owner == self.Owner).ToArray();
|
.Where(p => p.Actor.Owner == self.Owner).ToArray();
|
||||||
|
|
||||||
var speedUp = 1 - (selfsameBuildings.First().Trait.Info.SpeedUp * (selfsameBuildings.Count() - 1))
|
var selfsameQueue = Rules.Info["player"].Traits.WithInterface<ClassicProductionQueueInfo>()
|
||||||
.Clamp(0, selfsameBuildings.First().Trait.Info.MaxSpeedUp);
|
.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
|
var time = cost
|
||||||
* Info.BuildSpeed
|
* Info.BuildSpeed
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly string[] Produces = { };
|
public readonly string[] Produces = { };
|
||||||
|
|
||||||
public readonly float SpeedUp = 0;
|
|
||||||
public readonly float MaxSpeedUp = 0;
|
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new Production(this); }
|
public virtual object Create(ActorInitializer init) { return new Production(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user