Fix IDE0032

This commit is contained in:
RoosterDragon
2023-02-19 11:19:28 +00:00
committed by Pavel Penev
parent e64c0a35c5
commit 98c4eaca83
52 changed files with 460 additions and 567 deletions

View File

@@ -235,28 +235,26 @@ namespace OpenRA.Mods.Common.Traits
INotifyCenterPositionChanged[] notifyCenterPositionChanged;
IOverrideAircraftLanding overrideAircraftLanding;
WRot orientation;
[Sync]
public WAngle Facing
{
get => orientation.Yaw;
set => orientation = orientation.WithYaw(value);
get => Orientation.Yaw;
set => Orientation = Orientation.WithYaw(value);
}
public WAngle Pitch
{
get => orientation.Pitch;
set => orientation = orientation.WithPitch(value);
get => Orientation.Pitch;
set => Orientation = Orientation.WithPitch(value);
}
public WAngle Roll
{
get => orientation.Roll;
set => orientation = orientation.WithRoll(value);
get => Orientation.Roll;
set => Orientation = Orientation.WithRoll(value);
}
public WRot Orientation => orientation;
public WRot Orientation { get; private set; }
[Sync]
public WPos CenterPosition { get; private set; }

View File

@@ -109,8 +109,6 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly WeaponInfo Weapon;
public readonly Barrel[] Barrels;
readonly Actor self;
Turreted turret;
BodyOrientation coords;
INotifyBurstComplete[] notifyBurstComplete;
@@ -136,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits
public Armament(Actor self, ArmamentInfo info)
: base(info)
{
this.self = self;
Actor = self;
Weapon = info.WeaponInfo;
Burst = Weapon.Burst;
@@ -400,6 +398,6 @@ namespace OpenRA.Mods.Common.Traits
return WRot.FromYaw(b.Yaw).Rotate(turret?.WorldOrientation ?? self.Orientation);
}
public Actor Actor => self;
public Actor Actor { get; }
}
}

View File

@@ -135,15 +135,13 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int nextScanTime = 0;
public UnitStance Stance => stance;
public UnitStance Stance { get; private set; }
[Sync]
public Actor Aggressor;
// NOT SYNCED: do not refer to this anywhere other than UI code
public UnitStance PredictedStance;
UnitStance stance;
IOverrideAutoTarget[] overrideAutoTarget;
INotifyStanceChanged[] notifyStanceChanged;
IEnumerable<AutoTargetPriorityInfo> activeTargetPriorities;
@@ -151,19 +149,19 @@ namespace OpenRA.Mods.Common.Traits
public void SetStance(Actor self, UnitStance value)
{
if (stance == value)
if (Stance == value)
return;
var oldStance = stance;
stance = value;
var oldStance = Stance;
Stance = value;
ApplyStanceCondition(self);
foreach (var nsc in notifyStanceChanged)
nsc.StanceChanged(self, this, oldStance, stance);
nsc.StanceChanged(self, this, oldStance, Stance);
if (self.CurrentActivity != null)
foreach (var a in self.CurrentActivity.ActivitiesImplementing<IActivityNotifyStanceChanged>())
a.StanceChanged(self, this, oldStance, stance);
a.StanceChanged(self, this, oldStance, Stance);
}
void ApplyStanceCondition(Actor self)
@@ -171,7 +169,7 @@ namespace OpenRA.Mods.Common.Traits
if (conditionToken != Actor.InvalidConditionToken)
conditionToken = self.RevokeCondition(conditionToken);
if (Info.ConditionByStance.TryGetValue(stance, out var condition))
if (Info.ConditionByStance.TryGetValue(Stance, out var condition))
conditionToken = self.GrantCondition(condition);
}
@@ -181,9 +179,9 @@ namespace OpenRA.Mods.Common.Traits
var self = init.Self;
ActiveAttackBases = self.TraitsImplementing<AttackBase>().ToArray().Where(t => !t.IsTraitDisabled);
stance = init.GetValue<StanceInit, UnitStance>(self.Owner.IsBot || !self.Owner.Playable ? info.InitialStanceAI : info.InitialStance);
Stance = init.GetValue<StanceInit, UnitStance>(self.Owner.IsBot || !self.Owner.Playable ? info.InitialStanceAI : info.InitialStance);
PredictedStance = stance;
PredictedStance = Stance;
allowMovement = Info.AllowMovement && self.TraitOrDefault<IMove>() != null;
}

View File

@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits
return randomConstructionYard?.Location ?? initialBaseCenter;
}
public CPos DefenseCenter => defenseCenter;
public CPos DefenseCenter { get; private set; }
readonly World world;
readonly Player player;
@@ -155,8 +155,6 @@ namespace OpenRA.Mods.Common.Traits
IResourceLayer resourceLayer;
IBotPositionsUpdated[] positionsUpdatedModules;
CPos initialBaseCenter;
CPos defenseCenter;
readonly List<BaseBuilderQueueManager> builders = new List<BaseBuilderQueueManager>();
public BaseBuilderBotModule(Actor self, BaseBuilderBotModuleInfo info)
@@ -189,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits
void IBotPositionsUpdated.UpdatedDefenseCenter(CPos newLocation)
{
defenseCenter = newLocation;
DefenseCenter = newLocation;
}
bool IBotRequestPauseUnitProduction.PauseUnitProduction => !IsTraitDisabled && !HasAdequateRefineryCount;
@@ -273,7 +271,7 @@ namespace OpenRA.Mods.Common.Traits
return new List<MiniYamlNode>()
{
new MiniYamlNode("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)),
new MiniYamlNode("DefenseCenter", FieldSaver.FormatValue(defenseCenter))
new MiniYamlNode("DefenseCenter", FieldSaver.FormatValue(DefenseCenter))
};
}
@@ -288,7 +286,7 @@ namespace OpenRA.Mods.Common.Traits
var defenseCenterNode = data.FirstOrDefault(n => n.Key == "DefenseCenter");
if (defenseCenterNode != null)
defenseCenter = FieldLoader.GetValue<CPos>("DefenseCenter", defenseCenterNode.Value.Value);
DefenseCenter = FieldLoader.GetValue<CPos>("DefenseCenter", defenseCenterNode.Value.Value);
}
}
}

View File

@@ -94,20 +94,18 @@ namespace OpenRA.Mods.Common.Traits
{
readonly Actor self;
readonly bool checkTerrainType;
DeployState deployState;
INotifyDeployTriggered[] notify;
int deployedToken = Actor.InvalidConditionToken;
int undeployedToken = Actor.InvalidConditionToken;
public DeployState DeployState => deployState;
public DeployState DeployState { get; private set; }
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info)
: base(info)
{
self = init.Self;
checkTerrainType = info.AllowedTerrainTypes.Count > 0;
deployState = init.GetValue<DeployStateInit, DeployState>(DeployState.Undeployed);
DeployState = init.GetValue<DeployStateInit, DeployState>(DeployState.Undeployed);
}
protected override void Created(Actor self)
@@ -115,14 +113,14 @@ namespace OpenRA.Mods.Common.Traits
notify = self.TraitsImplementing<INotifyDeployTriggered>().ToArray();
base.Created(self);
if (Info.Facing.HasValue && deployState != DeployState.Undeployed)
if (Info.Facing.HasValue && DeployState != DeployState.Undeployed)
{
var facing = self.TraitOrDefault<IFacing>();
if (facing != null)
facing.Facing = Info.Facing.Value;
}
switch (deployState)
switch (DeployState)
{
case DeployState.Undeployed:
OnUndeployCompleted();
@@ -153,10 +151,10 @@ namespace OpenRA.Mods.Common.Traits
bool IDelayCarryallPickup.TryLockForPickup(Actor self, Actor carrier)
{
if (!Info.UndeployOnPickup || deployState == DeployState.Undeployed || IsTraitDisabled)
if (!Info.UndeployOnPickup || DeployState == DeployState.Undeployed || IsTraitDisabled)
return true;
if (deployState == DeployState.Deployed && !IsTraitPaused)
if (DeployState == DeployState.Deployed && !IsTraitPaused)
Undeploy();
return false;
@@ -208,7 +206,7 @@ namespace OpenRA.Mods.Common.Traits
if (IsTraitPaused || IsTraitDisabled)
return false;
return IsValidTerrain(self.Location) || (deployState == DeployState.Deployed);
return IsValidTerrain(self.Location) || (DeployState == DeployState.Deployed);
}
public bool IsValidTerrain(CPos location)
@@ -253,7 +251,7 @@ namespace OpenRA.Mods.Common.Traits
void Deploy(bool init)
{
// Something went wrong, most likely due to deploy order spam and the fact that this is a delayed action.
if (!init && deployState != DeployState.Undeployed)
if (!init && DeployState != DeployState.Undeployed)
return;
if (!IsValidTerrain(self.Location))
@@ -280,7 +278,7 @@ namespace OpenRA.Mods.Common.Traits
void Undeploy(bool init)
{
// Something went wrong, most likely due to deploy order spam and the fact that this is a delayed action.
if (!init && deployState != DeployState.Deployed)
if (!init && DeployState != DeployState.Deployed)
return;
if (Info.UndeploySounds != null && Info.UndeploySounds.Length > 0)
@@ -303,7 +301,7 @@ namespace OpenRA.Mods.Common.Traits
if (undeployedToken != Actor.InvalidConditionToken)
undeployedToken = self.RevokeCondition(undeployedToken);
deployState = DeployState.Deploying;
DeployState = DeployState.Deploying;
}
void OnDeployCompleted()
@@ -311,7 +309,7 @@ namespace OpenRA.Mods.Common.Traits
if (deployedToken == Actor.InvalidConditionToken)
deployedToken = self.GrantCondition(Info.DeployedCondition);
deployState = DeployState.Deployed;
DeployState = DeployState.Deployed;
}
void OnUndeployStarted()
@@ -319,7 +317,7 @@ namespace OpenRA.Mods.Common.Traits
if (deployedToken != Actor.InvalidConditionToken)
deployedToken = self.RevokeCondition(deployedToken);
deployState = DeployState.Deploying;
DeployState = DeployState.Deploying;
}
void OnUndeployCompleted()
@@ -327,7 +325,7 @@ namespace OpenRA.Mods.Common.Traits
if (undeployedToken == Actor.InvalidConditionToken)
undeployedToken = self.GrantCondition(Info.UndeployedCondition);
deployState = DeployState.Undeployed;
DeployState = DeployState.Undeployed;
}
}

View File

@@ -67,16 +67,14 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public WPos CenterPosition { get; private set; }
WRot orientation;
[Sync]
public WAngle Facing
{
get => orientation.Yaw;
set => orientation = orientation.WithYaw(value);
get => Orientation.Yaw;
set => Orientation = Orientation.WithYaw(value);
}
public WRot Orientation => orientation;
public WRot Orientation { get; private set; }
public WAngle TurnSpeed => WAngle.Zero;

View File

@@ -194,7 +194,6 @@ namespace OpenRA.Mods.Common.Traits
WAngle oldFacing;
WRot orientation;
WPos oldPos;
CPos fromCell, toCell;
public SubCell FromSubCell, ToSubCell;
INotifyCustomLayerChanged[] notifyCustomLayerChanged;
@@ -226,10 +225,10 @@ namespace OpenRA.Mods.Common.Traits
#endregion
[Sync]
public CPos FromCell => fromCell;
public CPos FromCell { get; private set; }
[Sync]
public CPos ToCell => toCell;
public CPos ToCell { get; private set; }
public Locomotor Locomotor { get; private set; }
@@ -274,7 +273,7 @@ namespace OpenRA.Mods.Common.Traits
var locationInit = init.GetOrDefault<LocationInit>();
if (locationInit != null)
{
fromCell = toCell = locationInit.Value;
FromCell = ToCell = locationInit.Value;
SetCenterPosition(self, init.World.Map.CenterOfSubCell(FromCell, FromSubCell));
}
@@ -499,7 +498,7 @@ namespace OpenRA.Mods.Common.Traits
return;
foreach (var n in notifyCenterPositionChanged)
n.CenterPositionChanged(self, fromCell.Layer, toCell.Layer);
n.CenterPositionChanged(self, FromCell.Layer, ToCell.Layer);
}
public void SetTerrainRampOrientation(WRot orientation)
@@ -510,7 +509,7 @@ namespace OpenRA.Mods.Common.Traits
public bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any)
{
return ToCell != location && fromCell == location
return ToCell != location && FromCell == location
&& (subCell == SubCell.Any || FromSubCell == subCell || subCell == SubCell.FullCell || FromSubCell == SubCell.FullCell);
}
@@ -545,25 +544,25 @@ namespace OpenRA.Mods.Common.Traits
return;
RemoveInfluence();
fromCell = from;
toCell = to;
FromCell = from;
ToCell = to;
FromSubCell = fromSub;
ToSubCell = toSub;
AddInfluence();
IsBlocking = false;
// Most custom layer conditions are added/removed when starting the transition between layers.
if (toCell.Layer != fromCell.Layer)
if (ToCell.Layer != FromCell.Layer)
foreach (var n in notifyCustomLayerChanged)
n.CustomLayerChanged(self, fromCell.Layer, toCell.Layer);
n.CustomLayerChanged(self, FromCell.Layer, ToCell.Layer);
}
public void FinishedMoving(Actor self)
{
// Need to check both fromCell and toCell because FinishedMoving is called multiple times during the move
if (fromCell.Layer == toCell.Layer)
if (FromCell.Layer == ToCell.Layer)
foreach (var n in notifyFinishedMoving)
n.FinishedMoving(self, fromCell.Layer, toCell.Layer);
n.FinishedMoving(self, FromCell.Layer, ToCell.Layer);
// Only crush actors on having landed
if (!self.IsAtGroundLevel())

View File

@@ -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;

View File

@@ -27,11 +27,10 @@ namespace OpenRA.Mods.Common.Traits
public class TechTree
{
readonly List<Watcher> watchers = new List<Watcher>();
readonly Player player;
public TechTree(ActorInitializer init)
{
player = init.Self.Owner;
Owner = init.Self.Owner;
init.World.ActorAdded += ActorChanged;
init.World.ActorRemoved += ActorChanged;
}
@@ -39,13 +38,13 @@ namespace OpenRA.Mods.Common.Traits
public void ActorChanged(Actor a)
{
var bi = a.Info.TraitInfoOrDefault<BuildableInfo>();
if (a.Owner == player && (a.Info.HasTraitInfo<ITechTreePrerequisiteInfo>() || (bi != null && bi.BuildLimit > 0)))
if (a.Owner == Owner && (a.Info.HasTraitInfo<ITechTreePrerequisiteInfo>() || (bi != null && bi.BuildLimit > 0)))
Update();
}
public void Update()
{
var ownedPrerequisites = GatherOwnedPrerequisites(player);
var ownedPrerequisites = GatherOwnedPrerequisites(Owner);
foreach (var w in watchers)
w.Update(ownedPrerequisites);
}
@@ -67,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
public bool HasPrerequisites(IEnumerable<string> prerequisites)
{
var ownedPrereqs = GatherOwnedPrerequisites(player);
var ownedPrereqs = GatherOwnedPrerequisites(Owner);
return prerequisites.All(p => !(p.Replace("~", "").StartsWith("!", StringComparison.Ordinal)
^ !ownedPrereqs.ContainsKey(p.Replace("!", "").Replace("~", ""))));
}
@@ -109,16 +108,15 @@ namespace OpenRA.Mods.Common.Traits
return ret;
}
public Player Owner => player;
public Player Owner { get; }
class Watcher
{
public readonly string Key;
public ITechTreeElement RegisteredBy => watcher;
public ITechTreeElement RegisteredBy { get; }
// Strings may be either actor type, or "alternate name" key
readonly string[] prerequisites;
readonly ITechTreeElement watcher;
bool hasPrerequisites;
readonly int limit;
bool hidden;
@@ -128,7 +126,7 @@ namespace OpenRA.Mods.Common.Traits
{
Key = key;
this.prerequisites = prerequisites;
this.watcher = watcher;
RegisteredBy = watcher;
hasPrerequisites = false;
this.limit = limit;
hidden = false;
@@ -179,16 +177,16 @@ namespace OpenRA.Mods.Common.Traits
// Hide the item from the UI if a prereq annotated with '~' is not met.
if (nowHidden && !hidden)
watcher.PrerequisitesItemHidden(Key);
RegisteredBy.PrerequisitesItemHidden(Key);
if (!nowHidden && hidden)
watcher.PrerequisitesItemVisible(Key);
RegisteredBy.PrerequisitesItemVisible(Key);
if (nowHasPrerequisites && !hasPrerequisites)
watcher.PrerequisitesAvailable(Key);
RegisteredBy.PrerequisitesAvailable(Key);
if (!nowHasPrerequisites && hasPrerequisites)
watcher.PrerequisitesUnavailable(Key);
RegisteredBy.PrerequisitesUnavailable(Key);
hidden = nowHidden;
hasPrerequisites = nowHasPrerequisites;

View File

@@ -121,10 +121,9 @@ namespace OpenRA.Mods.Common.Traits
readonly SpawnActorPower power;
readonly SpawnActorPowerInfo info;
readonly SupportPowerManager manager;
readonly string order;
readonly MouseButton expectedButton;
public string OrderKey { get { return order; } }
public string OrderKey { get; }
public SelectSpawnActorPowerTarget(string order, SupportPowerManager manager, SpawnActorPower power, MouseButton button)
{
@@ -134,7 +133,7 @@ namespace OpenRA.Mods.Common.Traits
this.manager = manager;
this.power = power;
this.order = order;
OrderKey = order;
expectedButton = button;
info = (SpawnActorPowerInfo)power.Info;
@@ -148,13 +147,13 @@ namespace OpenRA.Mods.Common.Traits
yield break;
if (mi.Button == expectedButton)
yield return new Order(order, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
yield return new Order(OrderKey, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
}
protected override void Tick(World world)
{
// Cancel the OG if we can't use the power
if (!manager.Powers.ContainsKey(order))
if (!manager.Powers.ContainsKey(OrderKey))
world.CancelInputMode();
}

View File

@@ -279,11 +279,10 @@ namespace OpenRA.Mods.Common.Traits
public class SelectGenericPowerTarget : OrderGenerator
{
readonly SupportPowerManager manager;
readonly string order;
readonly string cursor;
readonly MouseButton expectedButton;
public string OrderKey => order;
public string OrderKey { get; }
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
{
@@ -292,7 +291,7 @@ namespace OpenRA.Mods.Common.Traits
manager.Self.World.Selection.Clear();
this.manager = manager;
this.order = order;
OrderKey = order;
this.cursor = cursor;
expectedButton = button;
}
@@ -301,13 +300,13 @@ namespace OpenRA.Mods.Common.Traits
{
world.CancelInputMode();
if (mi.Button == expectedButton && world.Map.Contains(cell))
yield return new Order(order, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
yield return new Order(OrderKey, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
}
protected override void Tick(World world)
{
// Cancel the OG if we can't use the power
if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready)
if (!manager.Powers.TryGetValue(OrderKey, out var p) || !p.Active || !p.Ready)
world.CancelInputMode();
}

View File

@@ -229,24 +229,23 @@ namespace OpenRA.Mods.Common.Traits
struct ActorsAtEnumerator : IEnumerator<Actor>
{
InfluenceNode node;
Actor current;
public ActorsAtEnumerator(InfluenceNode node)
{
this.node = node;
current = null;
Current = null;
}
public void Reset() { throw new NotSupportedException(); }
public Actor Current => current;
public Actor Current { get; private set; }
object IEnumerator.Current => current;
object IEnumerator.Current => Current;
public void Dispose() { }
public bool MoveNext()
{
while (node != null)
{
current = node.Actor;
Current = node.Actor;
node = node.Next;
return true;
}