style nits & lambda reduction in ClassicProductionQueue.cs
This commit is contained in:
@@ -23,15 +23,15 @@ namespace OpenRA.Mods.RA
|
|||||||
public class ClassicProductionQueue : ProductionQueue, ISync
|
public class ClassicProductionQueue : ProductionQueue, ISync
|
||||||
{
|
{
|
||||||
public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info )
|
public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info )
|
||||||
: base(self, self, info as ProductionQueueInfo) {}
|
: base(self, self, info) {}
|
||||||
|
|
||||||
|
[Sync] bool isActive = false;
|
||||||
|
|
||||||
[Sync] bool QueueActive = false;
|
|
||||||
public override void Tick( Actor self )
|
public override void Tick( Actor self )
|
||||||
{
|
{
|
||||||
QueueActive = self.World.ActorsWithTrait<Production>()
|
isActive = self.World.ActorsWithTrait<Production>()
|
||||||
.Where(x => x.Actor.Owner == self.Owner)
|
.Any(x => x.Actor.Owner == self.Owner
|
||||||
.Where(x => x.Trait.Info.Produces.Contains(Info.Type))
|
&& x.Trait.Info.Produces.Contains(Info.Type));
|
||||||
.Any();
|
|
||||||
|
|
||||||
base.Tick(self);
|
base.Tick(self);
|
||||||
}
|
}
|
||||||
@@ -39,21 +39,20 @@ namespace OpenRA.Mods.RA
|
|||||||
static ActorInfo[] None = { };
|
static ActorInfo[] None = { };
|
||||||
public override IEnumerable<ActorInfo> AllItems()
|
public override IEnumerable<ActorInfo> AllItems()
|
||||||
{
|
{
|
||||||
return QueueActive ? base.AllItems() : None;
|
return isActive ? base.AllItems() : None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ActorInfo> BuildableItems()
|
public override IEnumerable<ActorInfo> BuildableItems()
|
||||||
{
|
{
|
||||||
return QueueActive ? base.BuildableItems() : None;
|
return isActive ? base.BuildableItems() : None;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool BuildUnit( string name )
|
protected override bool BuildUnit( string name )
|
||||||
{
|
{
|
||||||
// Find a production structure to build this actor
|
// Find a production structure to build this actor
|
||||||
var producers = self.World
|
var producers = self.World.ActorsWithTrait<Production>()
|
||||||
.ActorsWithTrait<Production>()
|
.Where(x => x.Actor.Owner == self.Owner
|
||||||
.Where(x => x.Actor.Owner == self.Owner)
|
&& x.Trait.Info.Produces.Contains(Info.Type))
|
||||||
.Where(x => x.Trait.Info.Produces.Contains(Info.Type))
|
|
||||||
.OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary.
|
.OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary.
|
||||||
|
|
||||||
if (producers.Count() == 0)
|
if (producers.Count() == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user