Fix IDE0032
This commit is contained in:
committed by
Pavel Penev
parent
e64c0a35c5
commit
98c4eaca83
@@ -126,7 +126,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyOwnerChanged, INotifyKilled, INotifySold, ISync, INotifyTransform, INotifyCreated
|
||||
{
|
||||
public readonly ProductionQueueInfo Info;
|
||||
readonly Actor self;
|
||||
|
||||
// A list of things we could possibly build
|
||||
protected readonly Dictionary<ActorInfo, ProductionState> Producible = new Dictionary<ActorInfo, ProductionState>();
|
||||
@@ -142,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected DeveloperMode developerMode;
|
||||
protected TechTree techTree;
|
||||
|
||||
public Actor Actor => self;
|
||||
public Actor Actor { get; }
|
||||
|
||||
[Sync]
|
||||
public bool Enabled { get; protected set; }
|
||||
@@ -154,10 +153,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public ProductionQueue(ActorInitializer init, ProductionQueueInfo info)
|
||||
{
|
||||
self = init.Self;
|
||||
Actor = init.Self;
|
||||
Info = info;
|
||||
|
||||
Faction = init.GetValue<FactionInit, string>(self.Owner.Faction.InternalName);
|
||||
Faction = init.GetValue<FactionInit, string>(Actor.Owner.Faction.InternalName);
|
||||
IsValidFaction = info.Factions.Count == 0 || info.Factions.Contains(Faction);
|
||||
Enabled = IsValidFaction;
|
||||
|
||||
@@ -205,7 +204,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
techTree.Update();
|
||||
}
|
||||
|
||||
void INotifyKilled.Killed(Actor killed, AttackInfo e) { if (killed == self) { ClearQueue(); Enabled = false; } }
|
||||
void INotifyKilled.Killed(Actor killed, AttackInfo e) { if (killed == Actor) { ClearQueue(); Enabled = false; } }
|
||||
void INotifySold.Selling(Actor self) { ClearQueue(); Enabled = false; }
|
||||
void INotifySold.Sold(Actor self) { }
|
||||
|
||||
@@ -230,7 +229,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<ActorInfo> AllBuildables(string category)
|
||||
{
|
||||
return self.World.Map.Rules.Actors.Values
|
||||
return Actor.World.Map.Rules.Actors.Values
|
||||
.Where(x =>
|
||||
x.Name[0] != '^' &&
|
||||
x.HasTraitInfo<BuildableInfo>() &&
|
||||
@@ -239,22 +238,22 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void PrerequisitesAvailable(string key)
|
||||
{
|
||||
Producible[self.World.Map.Rules.Actors[key]].Buildable = true;
|
||||
Producible[Actor.World.Map.Rules.Actors[key]].Buildable = true;
|
||||
}
|
||||
|
||||
public void PrerequisitesUnavailable(string key)
|
||||
{
|
||||
Producible[self.World.Map.Rules.Actors[key]].Buildable = false;
|
||||
Producible[Actor.World.Map.Rules.Actors[key]].Buildable = false;
|
||||
}
|
||||
|
||||
public void PrerequisitesItemHidden(string key)
|
||||
{
|
||||
Producible[self.World.Map.Rules.Actors[key]].Visible = false;
|
||||
Producible[Actor.World.Map.Rules.Actors[key]].Visible = false;
|
||||
}
|
||||
|
||||
public void PrerequisitesItemVisible(string key)
|
||||
{
|
||||
Producible[self.World.Map.Rules.Actors[key]].Visible = true;
|
||||
Producible[Actor.World.Map.Rules.Actors[key]].Visible = true;
|
||||
}
|
||||
|
||||
public virtual bool IsProducing(ProductionItem item)
|
||||
@@ -381,8 +380,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (bi.BuildLimit > 0)
|
||||
{
|
||||
var owned = self.Owner.World.ActorsHavingTrait<Buildable>()
|
||||
.Count(a => a.Info.Name == actor.Name && a.Owner == self.Owner);
|
||||
var owned = Actor.Owner.World.ActorsHavingTrait<Buildable>()
|
||||
.Count(a => a.Info.Name == actor.Name && a.Owner == Actor.Owner);
|
||||
if (queueCount + owned >= bi.BuildLimit)
|
||||
return false;
|
||||
}
|
||||
@@ -591,7 +590,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var traits = productionTraits.Where(p => !p.IsTraitDisabled && p.Info.Produces.Contains(Info.Type));
|
||||
var unpaused = traits.FirstOrDefault(a => !a.IsTraitPaused);
|
||||
return new TraitPair<Production>(self, unpaused ?? traits.FirstOrDefault());
|
||||
return new TraitPair<Production>(Actor, unpaused ?? traits.FirstOrDefault());
|
||||
}
|
||||
|
||||
// Builds a unit from the actor that holds this queue (1 queue per building)
|
||||
@@ -601,7 +600,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var mostLikelyProducerTrait = MostLikelyProducer().Trait;
|
||||
|
||||
// Cannot produce if I'm dead or trait is disabled
|
||||
if (!self.IsInWorld || self.IsDead || mostLikelyProducerTrait == null)
|
||||
if (!Actor.IsInWorld || Actor.IsDead || mostLikelyProducerTrait == null)
|
||||
{
|
||||
CancelProduction(unit.Name, 1);
|
||||
return false;
|
||||
@@ -609,14 +608,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var inits = new TypeDictionary
|
||||
{
|
||||
new OwnerInit(self.Owner),
|
||||
new OwnerInit(Actor.Owner),
|
||||
new FactionInit(BuildableInfo.GetInitialFaction(unit, Faction))
|
||||
};
|
||||
|
||||
var bi = unit.TraitInfo<BuildableInfo>();
|
||||
var type = developerMode.AllTech ? Info.Type : (bi.BuildAtProductionType ?? Info.Type);
|
||||
var item = Queue.First(i => i.Done && i.Item == unit.Name);
|
||||
if (!mostLikelyProducerTrait.IsTraitPaused && mostLikelyProducerTrait.Produce(self, unit, type, inits, item.TotalCost))
|
||||
if (!mostLikelyProducerTrait.IsTraitPaused && mostLikelyProducerTrait.Produce(Actor, unit, type, inits, item.TotalCost))
|
||||
{
|
||||
EndProduction(item);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user