From dcad5c3f7c58111b026f430ebd6c41cbde4739f9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 14:42:08 +0000 Subject: [PATCH 01/11] Rename UpgradeManager to ConditionManager. --- OpenRA.Mods.Common/Lint/CheckConditions.cs | 2 +- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 2 +- .../Scripting/Properties/ConditionProperties.cs | 6 +++--- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 16 ++++++++-------- .../Traits/Buildings/PrimaryBuilding.cs | 10 +++++----- OpenRA.Mods.Common/Traits/Cargo.cs | 12 ++++++------ OpenRA.Mods.Common/Traits/Carryable.cs | 16 ++++++++-------- OpenRA.Mods.Common/Traits/Cloak.cs | 12 ++++++------ .../Crates/GrantExternalConditionCrateAction.cs | 4 ++-- OpenRA.Mods.Common/Traits/GainsExperience.cs | 4 ++-- .../Traits/GrantConditionOnPrerequisite.cs | 10 +++++----- OpenRA.Mods.Common/Traits/Parachutable.cs | 10 +++++----- OpenRA.Mods.Common/Traits/Pluggable.cs | 8 ++++---- .../Traits/Render/TimedConditionBar.cs | 2 +- .../SupportPowers/GrantExternalConditionPower.cs | 4 ++-- .../{UpgradeManager.cs => ConditionManager.cs} | 4 ++-- .../Traits/Upgrades/GrantCondition.cs | 10 +++++----- .../Upgrades/GrantConditionOnDamageState.cs | 10 +++++----- .../Traits/Upgrades/GrantConditionOnDeploy.cs | 16 ++++++++-------- .../Traits/Upgrades/GrantConditionOnMovement.cs | 10 +++++----- .../Traits/Upgrades/GrantConditionOnTerrain.cs | 10 +++++----- .../Upgrades/ProximityExternalCondition.cs | 6 +++--- .../Traits/Upgrades/UpgradableTrait.cs | 2 +- .../UtilityCommands/UpgradeRules.cs | 9 +++++++++ .../Warheads/GrantExternalConditionWarhead.cs | 2 +- OpenRA.Mods.D2k/Activities/SwallowActor.cs | 10 +++++----- OpenRA.Mods.RA/Traits/Disguise.cs | 10 +++++----- mods/cnc/rules/defaults.yaml | 4 ++-- mods/d2k/rules/arrakis.yaml | 2 +- mods/d2k/rules/defaults.yaml | 2 +- mods/ra/rules/defaults.yaml | 4 ++-- mods/ts/rules/defaults.yaml | 4 ++-- 32 files changed, 121 insertions(+), 112 deletions(-) rename OpenRA.Mods.Common/Traits/Upgrades/{UpgradeManager.cs => ConditionManager.cs} (98%) diff --git a/OpenRA.Mods.Common/Lint/CheckConditions.cs b/OpenRA.Mods.Common/Lint/CheckConditions.cs index 2a2b54c640..1883741101 100644 --- a/OpenRA.Mods.Common/Lint/CheckConditions.cs +++ b/OpenRA.Mods.Common/Lint/CheckConditions.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Lint if (ungranted.Any()) emitError("Actor type `{0}` consumes conditions that are not granted: {1}".F(actorInfo.Key, ungranted.JoinWith(", "))); - if ((consumed.Any() || granted.Any()) && actorInfo.Value.TraitInfoOrDefault() == null) + if ((consumed.Any() || granted.Any()) && actorInfo.Value.TraitInfoOrDefault() == null) emitError("Actor type `{0}` defines conditions but does not include an UpgradeManager".F(actorInfo.Key)); } } diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 7aea862391..8bce13f6df 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -498,7 +498,7 @@ - + diff --git a/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs index 83bbd4495a..1f22f340d2 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs @@ -20,15 +20,15 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Scripting { [ScriptPropertyGroup("General")] - public class ConditionProperties : ScriptActorProperties, Requires + public class ConditionProperties : ScriptActorProperties, Requires { - readonly UpgradeManager um; + readonly ConditionManager um; readonly Dictionary> legacyShim = new Dictionary>(); public ConditionProperties(ScriptContext context, Actor self) : base(context, self) { - um = self.Trait(); + um = self.Trait(); } [Desc("Grant an external condition on this actor and return the revocation token.", diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index be07531a5e..dc1c7358b4 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits public readonly AircraftInfo Info; readonly Actor self; - UpgradeManager um; + ConditionManager um; IDisposable reservation; IEnumerable speedModifiers; @@ -119,8 +119,8 @@ namespace OpenRA.Mods.Common.Traits bool airborne; bool cruising; bool firstTick = true; - int airborneToken = UpgradeManager.InvalidConditionToken; - int cruisingToken = UpgradeManager.InvalidConditionToken; + int airborneToken = ConditionManager.InvalidConditionToken; + int cruisingToken = ConditionManager.InvalidConditionToken; bool isMoving; bool isMovingVertically; @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits public void Created(Actor self) { - um = self.TraitOrDefault(); + um = self.TraitOrDefault(); speedModifiers = self.TraitsImplementing().ToArray().Select(sm => sm.GetSpeedModifier()); cachedPosition = self.CenterPosition; } @@ -669,7 +669,7 @@ namespace OpenRA.Mods.Common.Traits return; airborne = true; - if (um != null && !string.IsNullOrEmpty(Info.AirborneCondition) && airborneToken == UpgradeManager.InvalidConditionToken) + if (um != null && !string.IsNullOrEmpty(Info.AirborneCondition) && airborneToken == ConditionManager.InvalidConditionToken) airborneToken = um.GrantCondition(self, Info.AirborneCondition); } @@ -679,7 +679,7 @@ namespace OpenRA.Mods.Common.Traits return; airborne = false; - if (um != null && airborneToken != UpgradeManager.InvalidConditionToken) + if (um != null && airborneToken != ConditionManager.InvalidConditionToken) airborneToken = um.RevokeCondition(self, airborneToken); } @@ -693,7 +693,7 @@ namespace OpenRA.Mods.Common.Traits return; cruising = true; - if (um != null && !string.IsNullOrEmpty(Info.CruisingCondition) && cruisingToken == UpgradeManager.InvalidConditionToken) + if (um != null && !string.IsNullOrEmpty(Info.CruisingCondition) && cruisingToken == ConditionManager.InvalidConditionToken) cruisingToken = um.GrantCondition(self, Info.CruisingCondition); } @@ -702,7 +702,7 @@ namespace OpenRA.Mods.Common.Traits if (!cruising) return; cruising = false; - if (um != null && cruisingToken != UpgradeManager.InvalidConditionToken) + if (um != null && cruisingToken != ConditionManager.InvalidConditionToken) cruisingToken = um.RevokeCondition(self, cruisingToken); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs index 12e417367a..2f68729d5d 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs @@ -41,8 +41,8 @@ namespace OpenRA.Mods.Common.Traits public class PrimaryBuilding : INotifyCreated, IIssueOrder, IResolveOrder { readonly PrimaryBuildingInfo info; - UpgradeManager um; - int primaryToken = UpgradeManager.InvalidConditionToken; + ConditionManager um; + int primaryToken = ConditionManager.InvalidConditionToken; public bool IsPrimary { get; private set; } @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + um = self.TraitOrDefault(); } IEnumerable IIssueOrder.Orders @@ -95,12 +95,12 @@ namespace OpenRA.Mods.Common.Traits b.Trait.SetPrimaryProducer(b.Actor, false); } - if (um != null && primaryToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(info.PrimaryCondition)) + if (um != null && primaryToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.PrimaryCondition)) primaryToken = um.GrantCondition(self, info.PrimaryCondition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SelectionNotification, self.Owner.Faction.InternalName); } - else if (primaryToken != UpgradeManager.InvalidConditionToken) + else if (primaryToken != ConditionManager.InvalidConditionToken) primaryToken = um.RevokeCondition(self, primaryToken); } } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index f31f1070b7..a81622909e 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -88,8 +88,8 @@ namespace OpenRA.Mods.Common.Traits int totalWeight = 0; int reservedWeight = 0; Aircraft aircraft; - UpgradeManager upgradeManager; - int loadingToken = UpgradeManager.InvalidConditionToken; + ConditionManager upgradeManager; + int loadingToken = ConditionManager.InvalidConditionToken; Stack loadedTokens = new Stack(); CPos currentCell; @@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { aircraft = self.TraitOrDefault(); - upgradeManager = self.Trait(); + upgradeManager = self.Trait(); } static int GetWeight(Actor a) { return a.Info.TraitInfo().Weight; } @@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Traits if (!HasSpace(w)) return false; - if (upgradeManager != null && loadingToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.LoadingCondition)) + if (upgradeManager != null && loadingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.LoadingCondition)) loadingToken = upgradeManager.GrantCondition(self, Info.LoadingCondition); reserves.Add(a); @@ -225,7 +225,7 @@ namespace OpenRA.Mods.Common.Traits reservedWeight -= GetWeight(a); reserves.Remove(a); - if (loadingToken != UpgradeManager.InvalidConditionToken) + if (loadingToken != ConditionManager.InvalidConditionToken) loadingToken = upgradeManager.RevokeCondition(self, loadingToken); } @@ -321,7 +321,7 @@ namespace OpenRA.Mods.Common.Traits reservedWeight -= w; reserves.Remove(a); - if (loadingToken != UpgradeManager.InvalidConditionToken) + if (loadingToken != ConditionManager.InvalidConditionToken) loadingToken = upgradeManager.RevokeCondition(self, loadingToken); } diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index bc78ba666a..6680bf0224 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -33,9 +33,9 @@ namespace OpenRA.Mods.Common.Traits public class Carryable : UpgradableTrait { - UpgradeManager upgradeManager; - int reservedToken = UpgradeManager.InvalidConditionToken; - int carriedToken = UpgradeManager.InvalidConditionToken; + ConditionManager upgradeManager; + int reservedToken = ConditionManager.InvalidConditionToken; + int carriedToken = ConditionManager.InvalidConditionToken; public Actor Carrier { get; private set; } public bool Reserved { get { return state != State.Free; } } @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits protected override void Created(Actor self) { - upgradeManager = self.Trait(); + upgradeManager = self.Trait(); base.Created(self); } @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits attached = true; - if (carriedToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CarriedCondition)) + if (carriedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CarriedCondition)) carriedToken = upgradeManager.GrantCondition(self, Info.CarriedCondition); } @@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits attached = false; - if (carriedToken != UpgradeManager.InvalidConditionToken) + if (carriedToken != ConditionManager.InvalidConditionToken) carriedToken = upgradeManager.RevokeCondition(self, carriedToken); } @@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits state = State.Reserved; Carrier = carrier; - if (reservedToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.ReservedCondition)) + if (reservedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.ReservedCondition)) reservedToken = upgradeManager.GrantCondition(self, Info.ReservedCondition); return true; @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits state = State.Free; Carrier = null; - if (reservedToken != UpgradeManager.InvalidConditionToken) + if (reservedToken != ConditionManager.InvalidConditionToken) reservedToken = upgradeManager.RevokeCondition(self, reservedToken); } diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 7bdb5a8985..ecbdbd4a8d 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -66,11 +66,11 @@ namespace OpenRA.Mods.Common.Traits [Sync] int remainingTime; [Sync] bool damageDisabled; bool isDocking; - UpgradeManager upgradeManager; + ConditionManager upgradeManager; CPos? lastPos; bool wasCloaked = false; - int cloakedToken = UpgradeManager.InvalidConditionToken; + int cloakedToken = ConditionManager.InvalidConditionToken; public Cloak(CloakInfo info) : base(info) @@ -80,12 +80,12 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - upgradeManager = self.TraitOrDefault(); + upgradeManager = self.TraitOrDefault(); if (Cloaked) { wasCloaked = true; - if (upgradeManager != null && cloakedToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) + if (upgradeManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) cloakedToken = upgradeManager.GrantCondition(self, Info.CloakedCondition); } } @@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits var isCloaked = Cloaked; if (isCloaked && !wasCloaked) { - if (upgradeManager != null && cloakedToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) + if (upgradeManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) cloakedToken = upgradeManager.GrantCondition(self, Info.CloakedCondition); if (!self.TraitsImplementing().Any(a => a != this && a.Cloaked)) @@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits } else if (!isCloaked && wasCloaked) { - if (cloakedToken != UpgradeManager.InvalidConditionToken) + if (cloakedToken != ConditionManager.InvalidConditionToken) cloakedToken = upgradeManager.RevokeCondition(self, cloakedToken); if (!self.TraitsImplementing().Any(a => a != this && a.Cloaked)) diff --git a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs index daa82819b0..f612bec658 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits bool AcceptsCondition(Actor a) { - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); return um != null && um.AcceptsExternalCondition(a, info.Condition); } @@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits if (!a.IsInWorld || a.IsDead) continue; - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); // Condition token is ignored because we never revoke this condition. if (um != null) diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index bd08e47810..dd3c892e9a 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits readonly int initialExperience; readonly List> nextLevel = new List>(); - UpgradeManager um; + ConditionManager um; // Stored as a percentage of our value [Sync] int experience = 0; @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + um = self.TraitOrDefault(); if (initialExperience > 0) GiveExperience(initialExperience, info.SuppressLevelupAnimation); } diff --git a/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs b/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs index bd3ce0eb6f..009824cc96 100644 --- a/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs @@ -34,8 +34,8 @@ namespace OpenRA.Mods.Common.Traits readonly GrantConditionOnPrerequisiteInfo info; readonly GrantConditionOnPrerequisiteManager globalManager; - UpgradeManager manager; - int conditionToken = UpgradeManager.InvalidConditionToken; + ConditionManager manager; + int conditionToken = ConditionManager.InvalidConditionToken; bool wasAvailable; @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - manager = self.TraitOrDefault(); + manager = self.TraitOrDefault(); } void INotifyAddedToWorld.AddedToWorld(Actor self) @@ -67,9 +67,9 @@ namespace OpenRA.Mods.Common.Traits if (available == wasAvailable || manager == null) return; - if (available && conditionToken == UpgradeManager.InvalidConditionToken) + if (available && conditionToken == ConditionManager.InvalidConditionToken) conditionToken = manager.GrantCondition(self, info.Condition); - else if (!available && conditionToken != UpgradeManager.InvalidConditionToken) + else if (!available && conditionToken != ConditionManager.InvalidConditionToken) conditionToken = manager.RevokeCondition(self, conditionToken); wasAvailable = available; diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 5592dd8a8e..2b4b926314 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -50,8 +50,8 @@ namespace OpenRA.Mods.Common.Traits readonly ParachutableInfo info; readonly IPositionable positionable; - UpgradeManager um; - int parachutingToken = UpgradeManager.InvalidConditionToken; + ConditionManager um; + int parachutingToken = ConditionManager.InvalidConditionToken; public Parachutable(Actor self, ParachutableInfo info) { @@ -61,18 +61,18 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + um = self.TraitOrDefault(); } void INotifyParachute.OnParachute(Actor self) { - if (um != null && parachutingToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(info.ParachutingCondition)) + if (um != null && parachutingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.ParachutingCondition)) parachutingToken = um.GrantCondition(self, info.ParachutingCondition); } void INotifyParachute.OnLanded(Actor self, Actor ignore) { - if (parachutingToken != UpgradeManager.InvalidConditionToken) + if (parachutingToken != ConditionManager.InvalidConditionToken) parachutingToken = um.RevokeCondition(self, parachutingToken); if (!info.KilledOnImpassableTerrain) diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index 797558075a..79fe810a81 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -34,8 +34,8 @@ namespace OpenRA.Mods.Common.Traits public readonly PluggableInfo Info; readonly string initialPlug; - UpgradeManager upgradeManager; - int conditionToken = UpgradeManager.InvalidConditionToken; + ConditionManager upgradeManager; + int conditionToken = ConditionManager.InvalidConditionToken; string active; @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public void Created(Actor self) { - upgradeManager = self.TraitOrDefault(); + upgradeManager = self.TraitOrDefault(); if (!string.IsNullOrEmpty(initialPlug)) EnablePlug(self, initialPlug); @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits if (type != active) return; - if (conditionToken != UpgradeManager.InvalidConditionToken) + if (conditionToken != ConditionManager.InvalidConditionToken) conditionToken = upgradeManager.RevokeCondition(self, conditionToken); active = null; diff --git a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs index c97d5f77cd..03c7e666bd 100644 --- a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Visualizes the remaining time for an upgrade.")] - class TimedConditionBarInfo : ITraitInfo, Requires + class TimedConditionBarInfo : ITraitInfo, Requires { [FieldLoader.Require] [Desc("Condition that this bar corresponds to")] diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index b0098a2deb..6d4dad148a 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits foreach (var a in UnitsInRange(order.TargetLocation)) { - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); // Condition token is ignored because we never revoke this condition. if (um != null) @@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits if (!a.Owner.IsAlliedWith(Self.Owner)) return false; - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); return um != null && um.AcceptsExternalCondition(a, info.Condition); }); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradeManager.cs b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs similarity index 98% rename from OpenRA.Mods.Common/Traits/Upgrades/UpgradeManager.cs rename to OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs index 4c49bbbfc8..d219297ee8 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradeManager.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs @@ -25,9 +25,9 @@ namespace OpenRA.Mods.Common.Traits } [Desc("Attach this to a unit to enable dynamic upgrades by warheads, experience, crates, support powers, etc.")] - public class UpgradeManagerInfo : TraitInfo, Requires { } + public class ConditionManagerInfo : TraitInfo, Requires { } - public class UpgradeManager : INotifyCreated, ITick + public class ConditionManager : INotifyCreated, ITick { /// Value used to represent an invalid token. public static readonly int InvalidConditionToken = -1; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs index e212c1691b..708aabfba2 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs @@ -26,28 +26,28 @@ namespace OpenRA.Mods.Common.Traits class GrantCondition : UpgradableTrait { - UpgradeManager manager; - int conditionToken = UpgradeManager.InvalidConditionToken; + ConditionManager manager; + int conditionToken = ConditionManager.InvalidConditionToken; public GrantCondition(GrantConditionInfo info) : base(info) { } protected override void Created(Actor self) { - manager = self.Trait(); + manager = self.Trait(); base.Created(self); } protected override void TraitEnabled(Actor self) { - if (conditionToken == UpgradeManager.InvalidConditionToken) + if (conditionToken == ConditionManager.InvalidConditionToken) conditionToken = manager.GrantCondition(self, Info.Condition); } protected override void TraitDisabled(Actor self) { - if (conditionToken == UpgradeManager.InvalidConditionToken) + if (conditionToken == ConditionManager.InvalidConditionToken) return; conditionToken = manager.RevokeCondition(self, conditionToken); diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs index b4e568d794..6f3c672af4 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs @@ -41,8 +41,8 @@ namespace OpenRA.Mods.Common.Traits readonly GrantConditionOnDamageStateInfo info; readonly Health health; - UpgradeManager manager; - int conditionToken = UpgradeManager.InvalidConditionToken; + ConditionManager manager; + int conditionToken = ConditionManager.InvalidConditionToken; public GrantConditionOnDamageState(Actor self, GrantConditionOnDamageStateInfo info) { @@ -52,13 +52,13 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - manager = self.TraitOrDefault(); + manager = self.TraitOrDefault(); GrantUpgradeOnValidDamageState(self, health.DamageState); } void GrantUpgradeOnValidDamageState(Actor self, DamageState state) { - if (!info.ValidDamageStates.HasFlag(state) || conditionToken != UpgradeManager.InvalidConditionToken) + if (!info.ValidDamageStates.HasFlag(state) || conditionToken != ConditionManager.InvalidConditionToken) return; conditionToken = manager.GrantCondition(self, info.Condition); @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) { - var granted = conditionToken != UpgradeManager.InvalidConditionToken; + var granted = conditionToken != ConditionManager.InvalidConditionToken; if ((granted && info.GrantPermanently) || manager == null) return; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs index a84c44a33a..54230f79e3 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs @@ -72,9 +72,9 @@ namespace OpenRA.Mods.Common.Traits readonly Lazy body; DeployState deployState; - UpgradeManager manager; - int deployedToken = UpgradeManager.InvalidConditionToken; - int undeployedToken = UpgradeManager.InvalidConditionToken; + ConditionManager manager; + int deployedToken = ConditionManager.InvalidConditionToken; + int undeployedToken = ConditionManager.InvalidConditionToken; public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info) { @@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits public void Created(Actor self) { - manager = self.TraitOrDefault(); + manager = self.TraitOrDefault(); switch (deployState) { @@ -243,7 +243,7 @@ namespace OpenRA.Mods.Common.Traits void OnDeployStarted() { - if (undeployedToken != UpgradeManager.InvalidConditionToken) + if (undeployedToken != ConditionManager.InvalidConditionToken) undeployedToken = manager.RevokeCondition(self, undeployedToken); deployState = DeployState.Deploying; @@ -251,7 +251,7 @@ namespace OpenRA.Mods.Common.Traits void OnDeployCompleted() { - if (manager != null && !string.IsNullOrEmpty(info.DeployedCondition) && deployedToken == UpgradeManager.InvalidConditionToken) + if (manager != null && !string.IsNullOrEmpty(info.DeployedCondition) && deployedToken == ConditionManager.InvalidConditionToken) deployedToken = manager.GrantCondition(self, info.DeployedCondition); deployState = DeployState.Deployed; @@ -259,7 +259,7 @@ namespace OpenRA.Mods.Common.Traits void OnUndeployStarted() { - if (deployedToken != UpgradeManager.InvalidConditionToken) + if (deployedToken != ConditionManager.InvalidConditionToken) deployedToken = manager.RevokeCondition(self, deployedToken); deployState = DeployState.Deploying; @@ -267,7 +267,7 @@ namespace OpenRA.Mods.Common.Traits void OnUndeployCompleted() { - if (manager != null && !string.IsNullOrEmpty(info.UndeployedCondition) && undeployedToken == UpgradeManager.InvalidConditionToken) + if (manager != null && !string.IsNullOrEmpty(info.UndeployedCondition) && undeployedToken == ConditionManager.InvalidConditionToken) undeployedToken = manager.GrantCondition(self, info.UndeployedCondition); deployState = DeployState.Undeployed; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs index 17b12fd025..2265952abe 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs @@ -31,8 +31,8 @@ namespace OpenRA.Mods.Common.Traits { readonly IMove movement; - UpgradeManager manager; - int conditionToken = UpgradeManager.InvalidConditionToken; + ConditionManager manager; + int conditionToken = ConditionManager.InvalidConditionToken; public GrantConditionOnMovement(Actor self, GrantConditionOnMovementInfo info) : base(info) @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits protected override void Created(Actor self) { - manager = self.TraitOrDefault(); + manager = self.TraitOrDefault(); base.Created(self); } @@ -53,9 +53,9 @@ namespace OpenRA.Mods.Common.Traits var isMovingVertically = Info.ConsiderVerticalMovement ? movement.IsMovingVertically : false; var isMoving = !IsTraitDisabled && !self.IsDead && (movement.IsMoving || isMovingVertically); - if (isMoving && conditionToken == UpgradeManager.InvalidConditionToken) + if (isMoving && conditionToken == ConditionManager.InvalidConditionToken) conditionToken = manager.GrantCondition(self, Info.Condition); - else if (!isMoving && conditionToken != UpgradeManager.InvalidConditionToken) + else if (!isMoving && conditionToken != ConditionManager.InvalidConditionToken) conditionToken = manager.RevokeCondition(self, conditionToken); } } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs index 58f7a85404..97f53640be 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs @@ -32,8 +32,8 @@ namespace OpenRA.Mods.Common.Traits { readonly GrantConditionOnTerrainInfo info; - UpgradeManager manager; - int conditionToken = UpgradeManager.InvalidConditionToken; + ConditionManager manager; + int conditionToken = ConditionManager.InvalidConditionToken; string previousTerrain; public GrantConditionOnTerrain(ActorInitializer init, GrantConditionOnTerrainInfo info) @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - manager = self.TraitOrDefault(); + manager = self.TraitOrDefault(); } public void Tick(Actor self) @@ -55,9 +55,9 @@ namespace OpenRA.Mods.Common.Traits var wantsGranted = info.TerrainTypes.Contains(currentTerrain); if (currentTerrain != previousTerrain) { - if (wantsGranted && conditionToken == UpgradeManager.InvalidConditionToken) + if (wantsGranted && conditionToken == ConditionManager.InvalidConditionToken) conditionToken = manager.GrantCondition(self, info.Condition); - else if (!wantsGranted && conditionToken != UpgradeManager.InvalidConditionToken) + else if (!wantsGranted && conditionToken != ConditionManager.InvalidConditionToken) conditionToken = manager.RevokeCondition(self, conditionToken); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs index 4cfba835c3..2d7d879191 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs @@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Traits if (!info.ValidStances.HasStance(stance)) return; - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); if (um != null && !tokens.ContainsKey(a) && um.AcceptsExternalCondition(a, info.Condition)) tokens[a] = um.GrantCondition(a, info.Condition, true); } @@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits if (!info.ValidStances.HasStance(stance)) return; - var um = produced.TraitOrDefault(); + var um = produced.TraitOrDefault(); if (um != null && um.AcceptsExternalCondition(produced, info.Condition)) tokens[produced] = um.GrantCondition(produced, info.Condition, true); } @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits return; tokens.Remove(a); - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); if (um != null) um.RevokeCondition(a, token); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs b/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs index b4ca31189b..fb4247c00c 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits { Info = info; - // Conditional traits will be enabled (if appropriate) by the UpgradeManager + // Conditional traits will be enabled (if appropriate) by the ConditionManager // calling IConditionConsumer.ConditionsChanged at the end of INotifyCreated. IsTraitDisabled = Info.RequiresCondition != null; } diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index bef16aec33..f43ce3a431 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -695,6 +695,15 @@ namespace OpenRA.Mods.Common.UtilityCommands RenameNodeKey(node, "DisableOnCondition"); } + if (engineVersion < 20161223) + { + if (node.Key.StartsWith("UpgradeManager", StringComparison.Ordinal)) + RenameNodeKey(node, "ConditionManager"); + + if (node.Key.StartsWith("-UpgradeManager", StringComparison.Ordinal)) + RenameNodeKey(node, "-ConditionManager"); + } + UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); } diff --git a/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs b/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs index 73173a4f6e..147ca4c860 100644 --- a/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Warheads if (!IsValidAgainst(a, firedBy)) continue; - var um = a.TraitOrDefault(); + var um = a.TraitOrDefault(); // Condition token is ignored because we never revoke this condition. if (um != null && um.AcceptsExternalCondition(a, Condition)) diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 39a1cd36e0..6c7ac23bab 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.D2k.Activities readonly Target target; readonly Sandworm sandworm; - readonly UpgradeManager manager; + readonly ConditionManager manager; readonly WeaponInfo weapon; readonly RadarPings radarPings; readonly AttackSwallow swallow; @@ -37,7 +37,7 @@ namespace OpenRA.Mods.D2k.Activities int countdown; CPos burrowLocation; AttackState stance; - int attackingToken = UpgradeManager.InvalidConditionToken; + int attackingToken = ConditionManager.InvalidConditionToken; public SwallowActor(Actor self, Target target, WeaponInfo weapon) { @@ -46,7 +46,7 @@ namespace OpenRA.Mods.D2k.Activities sandworm = self.Trait(); positionable = self.Trait(); swallow = self.Trait(); - manager = self.TraitOrDefault(); + manager = self.TraitOrDefault(); radarPings = self.World.WorldActor.TraitOrDefault(); } @@ -109,7 +109,7 @@ namespace OpenRA.Mods.D2k.Activities stance = AttackState.Burrowed; countdown = swallow.Info.AttackDelay; burrowLocation = self.Location; - if (manager != null && attackingToken == UpgradeManager.InvalidConditionToken && + if (manager != null && attackingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(swallow.Info.AttackingCondition)) attackingToken = manager.GrantCondition(self, swallow.Info.AttackingCondition); break; @@ -170,7 +170,7 @@ namespace OpenRA.Mods.D2k.Activities void RevokeCondition(Actor self) { - if (attackingToken != UpgradeManager.InvalidConditionToken) + if (attackingToken != ConditionManager.InvalidConditionToken) attackingToken = manager.RevokeCondition(self, attackingToken); } } diff --git a/OpenRA.Mods.RA/Traits/Disguise.cs b/OpenRA.Mods.RA/Traits/Disguise.cs index 9f3980e9ae..f3e6b64118 100644 --- a/OpenRA.Mods.RA/Traits/Disguise.cs +++ b/OpenRA.Mods.RA/Traits/Disguise.cs @@ -83,8 +83,8 @@ namespace OpenRA.Mods.RA.Traits readonly Actor self; readonly DisguiseInfo info; - UpgradeManager um; - int disguisedToken = UpgradeManager.InvalidConditionToken; + ConditionManager um; + int disguisedToken = ConditionManager.InvalidConditionToken; public Disguise(Actor self, DisguiseInfo info) { @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + um = self.TraitOrDefault(); } public IEnumerable Orders @@ -189,9 +189,9 @@ namespace OpenRA.Mods.RA.Traits if (Disguised != oldDisguiseSetting && um != null) { - if (Disguised && disguisedToken == UpgradeManager.InvalidConditionToken && !string.IsNullOrEmpty(info.DisguisedCondition)) + if (Disguised && disguisedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.DisguisedCondition)) disguisedToken = um.GrantCondition(self, info.DisguisedCondition); - else if (!Disguised && disguisedToken != UpgradeManager.InvalidConditionToken) + else if (!Disguised && disguisedToken != ConditionManager.InvalidConditionToken) disguisedToken = um.RevokeCondition(self, disguisedToken); } } diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index c0be31ff26..4b0a9bc032 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -5,7 +5,7 @@ GivesExperience: PlayerExperienceModifier: 1 ScriptTriggers: - UpgradeManager: + ConditionManager: RenderDebugState: ^SpriteActor: @@ -605,7 +605,7 @@ ^CivBuilding: Inherits: ^Building - -UpgradeManager: + -ConditionManager: Health: HP: 400 Tooltip: diff --git a/mods/d2k/rules/arrakis.yaml b/mods/d2k/rules/arrakis.yaml index 680f14e3cd..f5873ab319 100644 --- a/mods/d2k/rules/arrakis.yaml +++ b/mods/d2k/rules/arrakis.yaml @@ -106,7 +106,7 @@ sandworm: TerrainTypes: Sand, Dune, SpiceSand, Spice MovingInterval: 3 RequiresCondition: !attacking - UpgradeManager: + ConditionManager: Buildable: Description: Attracted by vibrations in the sand.\nWill eat units whole and has a large appetite. diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 82510b2530..4cf7587ef7 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -5,7 +5,7 @@ GivesExperience: PlayerExperienceModifier: 1 ScriptTriggers: - UpgradeManager: + ConditionManager: RenderDebugState: ^SpriteActor: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 15d749bee7..849772126a 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -4,7 +4,7 @@ GivesExperience: PlayerExperienceModifier: 1 ScriptTriggers: - UpgradeManager: + ConditionManager: RenderDebugState: ^SpriteActor: @@ -894,7 +894,7 @@ ShadowImage: parach-shadow ShadowSequence: idle RequiresCondition: parachute - UpgradeManager: + ConditionManager: ^Mine: Inherits: ^SpriteActor diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 0f7f9aace2..a9a79c56c4 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -5,7 +5,7 @@ GivesExperience: PlayerExperienceModifier: 1 ScriptTriggers: - UpgradeManager: + ConditionManager: RenderDebugState: ^SpriteActor: @@ -246,7 +246,7 @@ SellSounds: cashturn.aud Demolishable: ScriptTriggers: - UpgradeManager: + ConditionManager: Health: Shape: Rectangle RotateToIsometry: true From f360c10569c25f0553889a7dd424fb2d52e131ec Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:02:52 +0000 Subject: [PATCH 02/11] Rename ConditionManager variables. --- .../Properties/ConditionProperties.cs | 12 +++++----- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 20 ++++++++-------- .../Traits/Buildings/PrimaryBuilding.cs | 10 ++++---- OpenRA.Mods.Common/Traits/Cargo.cs | 24 +++++++++---------- OpenRA.Mods.Common/Traits/Carryable.cs | 12 +++++----- OpenRA.Mods.Common/Traits/Cloak.cs | 14 +++++------ .../GrantExternalConditionCrateAction.cs | 10 ++++---- OpenRA.Mods.Common/Traits/GainsExperience.cs | 8 +++---- .../Traits/GrantConditionOnPrerequisite.cs | 10 ++++---- OpenRA.Mods.Common/Traits/Parachutable.cs | 10 ++++---- OpenRA.Mods.Common/Traits/Pluggable.cs | 8 +++---- .../GrantExternalConditionPower.cs | 10 ++++---- .../Traits/Upgrades/GrantCondition.cs | 8 +++---- .../Upgrades/GrantConditionOnDamageState.cs | 10 ++++---- .../Traits/Upgrades/GrantConditionOnDeploy.cs | 16 ++++++------- .../Upgrades/GrantConditionOnMovement.cs | 10 ++++---- .../Upgrades/GrantConditionOnTerrain.cs | 10 ++++---- .../Upgrades/ProximityExternalCondition.cs | 18 +++++++------- .../Warheads/GrantExternalConditionWarhead.cs | 6 ++--- OpenRA.Mods.D2k/Activities/SwallowActor.cs | 10 ++++---- OpenRA.Mods.RA/Traits/Disguise.cs | 10 ++++---- 21 files changed, 123 insertions(+), 123 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs index 1f22f340d2..7254161eb9 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs @@ -22,13 +22,13 @@ namespace OpenRA.Mods.Common.Scripting [ScriptPropertyGroup("General")] public class ConditionProperties : ScriptActorProperties, Requires { - readonly ConditionManager um; + readonly ConditionManager conditionManager; readonly Dictionary> legacyShim = new Dictionary>(); public ConditionProperties(ScriptContext context, Actor self) : base(context, self) { - um = self.Trait(); + conditionManager = self.Trait(); } [Desc("Grant an external condition on this actor and return the revocation token.", @@ -36,22 +36,22 @@ namespace OpenRA.Mods.Common.Scripting "If duration > 0 the condition will be automatically revoked after the defined number of ticks")] public int GrantCondition(string condition, int duration = 0) { - if (!um.AcceptsExternalCondition(Self, condition)) + if (!conditionManager.AcceptsExternalCondition(Self, condition)) throw new InvalidDataException("Condition `{0}` has not been listed on an ExternalConditions trait".F(condition)); - return um.GrantCondition(Self, condition, true, duration); + return conditionManager.GrantCondition(Self, condition, true, duration); } [Desc("Revoke a condition using the token returned by GrantCondition.")] public void RevokeCondition(int token) { - um.RevokeCondition(Self, token); + conditionManager.RevokeCondition(Self, token); } [Desc("Check whether this actor accepts a specific external condition.")] public bool AcceptsCondition(string condition) { - return um.AcceptsExternalCondition(Self, condition); + return conditionManager.AcceptsExternalCondition(Self, condition); } [Desc("Grant an upgrade to this actor. DEPRECATED! Will be removed.")] diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index dc1c7358b4..d7831a1e2b 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits public readonly AircraftInfo Info; readonly Actor self; - ConditionManager um; + ConditionManager conditionManager; IDisposable reservation; IEnumerable speedModifiers; @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits public void Created(Actor self) { - um = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); speedModifiers = self.TraitsImplementing().ToArray().Select(sm => sm.GetSpeedModifier()); cachedPosition = self.CenterPosition; } @@ -669,8 +669,8 @@ namespace OpenRA.Mods.Common.Traits return; airborne = true; - if (um != null && !string.IsNullOrEmpty(Info.AirborneCondition) && airborneToken == ConditionManager.InvalidConditionToken) - airborneToken = um.GrantCondition(self, Info.AirborneCondition); + if (conditionManager != null && !string.IsNullOrEmpty(Info.AirborneCondition) && airborneToken == ConditionManager.InvalidConditionToken) + airborneToken = conditionManager.GrantCondition(self, Info.AirborneCondition); } void OnAirborneAltitudeLeft() @@ -679,8 +679,8 @@ namespace OpenRA.Mods.Common.Traits return; airborne = false; - if (um != null && airborneToken != ConditionManager.InvalidConditionToken) - airborneToken = um.RevokeCondition(self, airborneToken); + if (conditionManager != null && airborneToken != ConditionManager.InvalidConditionToken) + airborneToken = conditionManager.RevokeCondition(self, airborneToken); } #endregion @@ -693,8 +693,8 @@ namespace OpenRA.Mods.Common.Traits return; cruising = true; - if (um != null && !string.IsNullOrEmpty(Info.CruisingCondition) && cruisingToken == ConditionManager.InvalidConditionToken) - cruisingToken = um.GrantCondition(self, Info.CruisingCondition); + if (conditionManager != null && !string.IsNullOrEmpty(Info.CruisingCondition) && cruisingToken == ConditionManager.InvalidConditionToken) + cruisingToken = conditionManager.GrantCondition(self, Info.CruisingCondition); } void OnCruisingAltitudeLeft() @@ -702,8 +702,8 @@ namespace OpenRA.Mods.Common.Traits if (!cruising) return; cruising = false; - if (um != null && cruisingToken != ConditionManager.InvalidConditionToken) - cruisingToken = um.RevokeCondition(self, cruisingToken); + if (conditionManager != null && cruisingToken != ConditionManager.InvalidConditionToken) + cruisingToken = conditionManager.RevokeCondition(self, cruisingToken); } #endregion diff --git a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs index 2f68729d5d..f74ac03bbe 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public class PrimaryBuilding : INotifyCreated, IIssueOrder, IResolveOrder { readonly PrimaryBuildingInfo info; - ConditionManager um; + ConditionManager conditionManager; int primaryToken = ConditionManager.InvalidConditionToken; public bool IsPrimary { get; private set; } @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); } IEnumerable IIssueOrder.Orders @@ -95,13 +95,13 @@ namespace OpenRA.Mods.Common.Traits b.Trait.SetPrimaryProducer(b.Actor, false); } - if (um != null && primaryToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.PrimaryCondition)) - primaryToken = um.GrantCondition(self, info.PrimaryCondition); + if (conditionManager != null && primaryToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.PrimaryCondition)) + primaryToken = conditionManager.GrantCondition(self, info.PrimaryCondition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SelectionNotification, self.Owner.Faction.InternalName); } else if (primaryToken != ConditionManager.InvalidConditionToken) - primaryToken = um.RevokeCondition(self, primaryToken); + primaryToken = conditionManager.RevokeCondition(self, primaryToken); } } } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index a81622909e..676510c4c3 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits int totalWeight = 0; int reservedWeight = 0; Aircraft aircraft; - ConditionManager upgradeManager; + ConditionManager conditionManager; int loadingToken = ConditionManager.InvalidConditionToken; Stack loadedTokens = new Stack(); @@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { aircraft = self.TraitOrDefault(); - upgradeManager = self.Trait(); + conditionManager = self.Trait(); } static int GetWeight(Actor a) { return a.Info.TraitInfo().Weight; } @@ -208,8 +208,8 @@ namespace OpenRA.Mods.Common.Traits if (!HasSpace(w)) return false; - if (upgradeManager != null && loadingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.LoadingCondition)) - loadingToken = upgradeManager.GrantCondition(self, Info.LoadingCondition); + if (conditionManager != null && loadingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.LoadingCondition)) + loadingToken = conditionManager.GrantCondition(self, Info.LoadingCondition); reserves.Add(a); reservedWeight += w; @@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Traits reserves.Remove(a); if (loadingToken != ConditionManager.InvalidConditionToken) - loadingToken = upgradeManager.RevokeCondition(self, loadingToken); + loadingToken = conditionManager.RevokeCondition(self, loadingToken); } public string CursorForOrder(Actor self, Order order) @@ -266,10 +266,10 @@ namespace OpenRA.Mods.Common.Traits Stack passengerToken; if (passengerTokens.TryGetValue(a.Info.Name, out passengerToken) && passengerToken.Any()) - upgradeManager.RevokeCondition(self, passengerToken.Pop()); + conditionManager.RevokeCondition(self, passengerToken.Pop()); if (loadedTokens.Any()) - upgradeManager.RevokeCondition(self, loadedTokens.Pop()); + conditionManager.RevokeCondition(self, loadedTokens.Pop()); return a; } @@ -322,7 +322,7 @@ namespace OpenRA.Mods.Common.Traits reserves.Remove(a); if (loadingToken != ConditionManager.InvalidConditionToken) - loadingToken = upgradeManager.RevokeCondition(self, loadingToken); + loadingToken = conditionManager.RevokeCondition(self, loadingToken); } // If not initialized then this will be notified in the first tick @@ -334,11 +334,11 @@ namespace OpenRA.Mods.Common.Traits p.Transport = self; string passengerCondition; - if (upgradeManager != null && Info.PassengerConditions.TryGetValue(a.Info.Name, out passengerCondition)) - passengerTokens.GetOrAdd(a.Info.Name).Push(upgradeManager.GrantCondition(self, passengerCondition)); + if (conditionManager != null && Info.PassengerConditions.TryGetValue(a.Info.Name, out passengerCondition)) + passengerTokens.GetOrAdd(a.Info.Name).Push(conditionManager.GrantCondition(self, passengerCondition)); - if (upgradeManager != null && !string.IsNullOrEmpty(Info.LoadedCondition)) - loadedTokens.Push(upgradeManager.GrantCondition(self, Info.LoadedCondition)); + if (conditionManager != null && !string.IsNullOrEmpty(Info.LoadedCondition)) + loadedTokens.Push(conditionManager.GrantCondition(self, Info.LoadedCondition)); } void INotifyKilled.Killed(Actor self, AttackInfo e) diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index 6680bf0224..b368707095 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits public class Carryable : UpgradableTrait { - ConditionManager upgradeManager; + ConditionManager conditionManager; int reservedToken = ConditionManager.InvalidConditionToken; int carriedToken = ConditionManager.InvalidConditionToken; @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits protected override void Created(Actor self) { - upgradeManager = self.Trait(); + conditionManager = self.Trait(); base.Created(self); } @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits attached = true; if (carriedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CarriedCondition)) - carriedToken = upgradeManager.GrantCondition(self, Info.CarriedCondition); + carriedToken = conditionManager.GrantCondition(self, Info.CarriedCondition); } // This gets called by carrier after we touched down @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits attached = false; if (carriedToken != ConditionManager.InvalidConditionToken) - carriedToken = upgradeManager.RevokeCondition(self, carriedToken); + carriedToken = conditionManager.RevokeCondition(self, carriedToken); } public virtual bool Reserve(Actor self, Actor carrier) @@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits Carrier = carrier; if (reservedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.ReservedCondition)) - reservedToken = upgradeManager.GrantCondition(self, Info.ReservedCondition); + reservedToken = conditionManager.GrantCondition(self, Info.ReservedCondition); return true; } @@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits Carrier = null; if (reservedToken != ConditionManager.InvalidConditionToken) - reservedToken = upgradeManager.RevokeCondition(self, reservedToken); + reservedToken = conditionManager.RevokeCondition(self, reservedToken); } // Prepare for transport pickup diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index ecbdbd4a8d..44ac320395 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits [Sync] int remainingTime; [Sync] bool damageDisabled; bool isDocking; - ConditionManager upgradeManager; + ConditionManager conditionManager; CPos? lastPos; bool wasCloaked = false; @@ -80,13 +80,13 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - upgradeManager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); if (Cloaked) { wasCloaked = true; - if (upgradeManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) - cloakedToken = upgradeManager.GrantCondition(self, Info.CloakedCondition); + if (conditionManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) + cloakedToken = conditionManager.GrantCondition(self, Info.CloakedCondition); } } @@ -144,8 +144,8 @@ namespace OpenRA.Mods.Common.Traits var isCloaked = Cloaked; if (isCloaked && !wasCloaked) { - if (upgradeManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) - cloakedToken = upgradeManager.GrantCondition(self, Info.CloakedCondition); + if (conditionManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) + cloakedToken = conditionManager.GrantCondition(self, Info.CloakedCondition); if (!self.TraitsImplementing().Any(a => a != this && a.Cloaked)) Game.Sound.Play(SoundType.World, Info.CloakSound, self.CenterPosition); @@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Traits else if (!isCloaked && wasCloaked) { if (cloakedToken != ConditionManager.InvalidConditionToken) - cloakedToken = upgradeManager.RevokeCondition(self, cloakedToken); + cloakedToken = conditionManager.RevokeCondition(self, cloakedToken); if (!self.TraitsImplementing().Any(a => a != this && a.Cloaked)) Game.Sound.Play(SoundType.World, Info.UncloakSound, self.CenterPosition); diff --git a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs index f612bec658..a8d2a8c695 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs @@ -47,8 +47,8 @@ namespace OpenRA.Mods.Common.Traits bool AcceptsCondition(Actor a) { - var um = a.TraitOrDefault(); - return um != null && um.AcceptsExternalCondition(a, info.Condition); + var cm = a.TraitOrDefault(); + return cm != null && cm.AcceptsExternalCondition(a, info.Condition); } public override int GetSelectionShares(Actor collector) @@ -71,11 +71,11 @@ namespace OpenRA.Mods.Common.Traits if (!a.IsInWorld || a.IsDead) continue; - var um = a.TraitOrDefault(); + var cm = a.TraitOrDefault(); // Condition token is ignored because we never revoke this condition. - if (um != null) - um.GrantCondition(a, info.Condition, true, info.Duration); + if (cm != null) + cm.GrantCondition(a, info.Condition, true, info.Duration); } }); diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index dd3c892e9a..e84501d087 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits readonly int initialExperience; readonly List> nextLevel = new List>(); - ConditionManager um; + ConditionManager conditionManager; // Stored as a percentage of our value [Sync] int experience = 0; @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); if (initialExperience > 0) GiveExperience(initialExperience, info.SuppressLevelupAnimation); } @@ -92,8 +92,8 @@ namespace OpenRA.Mods.Common.Traits while (Level < MaxLevel && experience >= nextLevel[Level].First) { - if (um != null) - um.GrantCondition(self, nextLevel[Level].Second); + if (conditionManager != null) + conditionManager.GrantCondition(self, nextLevel[Level].Second); Level++; diff --git a/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs b/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs index 009824cc96..4df6b24fff 100644 --- a/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits readonly GrantConditionOnPrerequisiteInfo info; readonly GrantConditionOnPrerequisiteManager globalManager; - ConditionManager manager; + ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; bool wasAvailable; @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - manager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); } void INotifyAddedToWorld.AddedToWorld(Actor self) @@ -64,13 +64,13 @@ namespace OpenRA.Mods.Common.Traits public void PrerequisitesUpdated(Actor self, bool available) { - if (available == wasAvailable || manager == null) + if (available == wasAvailable || conditionManager == null) return; if (available && conditionToken == ConditionManager.InvalidConditionToken) - conditionToken = manager.GrantCondition(self, info.Condition); + conditionToken = conditionManager.GrantCondition(self, info.Condition); else if (!available && conditionToken != ConditionManager.InvalidConditionToken) - conditionToken = manager.RevokeCondition(self, conditionToken); + conditionToken = conditionManager.RevokeCondition(self, conditionToken); wasAvailable = available; } diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 2b4b926314..03d770928a 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits readonly ParachutableInfo info; readonly IPositionable positionable; - ConditionManager um; + ConditionManager conditionManager; int parachutingToken = ConditionManager.InvalidConditionToken; public Parachutable(Actor self, ParachutableInfo info) @@ -61,19 +61,19 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); } void INotifyParachute.OnParachute(Actor self) { - if (um != null && parachutingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.ParachutingCondition)) - parachutingToken = um.GrantCondition(self, info.ParachutingCondition); + if (conditionManager != null && parachutingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.ParachutingCondition)) + parachutingToken = conditionManager.GrantCondition(self, info.ParachutingCondition); } void INotifyParachute.OnLanded(Actor self, Actor ignore) { if (parachutingToken != ConditionManager.InvalidConditionToken) - parachutingToken = um.RevokeCondition(self, parachutingToken); + parachutingToken = conditionManager.RevokeCondition(self, parachutingToken); if (!info.KilledOnImpassableTerrain) return; diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index 79fe810a81..fa03d36687 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits public readonly PluggableInfo Info; readonly string initialPlug; - ConditionManager upgradeManager; + ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; string active; @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public void Created(Actor self) { - upgradeManager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); if (!string.IsNullOrEmpty(initialPlug)) EnablePlug(self, initialPlug); @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits if (!Info.Conditions.TryGetValue(type, out condition)) return; - conditionToken = upgradeManager.GrantCondition(self, condition); + conditionToken = conditionManager.GrantCondition(self, condition); active = type; } @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits return; if (conditionToken != ConditionManager.InvalidConditionToken) - conditionToken = upgradeManager.RevokeCondition(self, conditionToken); + conditionToken = conditionManager.RevokeCondition(self, conditionToken); active = null; } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index 6d4dad148a..ec17c31f20 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -69,11 +69,11 @@ namespace OpenRA.Mods.Common.Traits foreach (var a in UnitsInRange(order.TargetLocation)) { - var um = a.TraitOrDefault(); + var cm = a.TraitOrDefault(); // Condition token is ignored because we never revoke this condition. - if (um != null) - um.GrantCondition(a, info.Condition, true, info.Duration); + if (cm != null) + cm.GrantCondition(a, info.Condition, true, info.Duration); } } @@ -90,8 +90,8 @@ namespace OpenRA.Mods.Common.Traits if (!a.Owner.IsAlliedWith(Self.Owner)) return false; - var um = a.TraitOrDefault(); - return um != null && um.AcceptsExternalCondition(a, info.Condition); + var cm = a.TraitOrDefault(); + return cm != null && cm.AcceptsExternalCondition(a, info.Condition); }); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs index 708aabfba2..1b122de42c 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits class GrantCondition : UpgradableTrait { - ConditionManager manager; + ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; public GrantCondition(GrantConditionInfo info) @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits protected override void Created(Actor self) { - manager = self.Trait(); + conditionManager = self.Trait(); base.Created(self); } @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits protected override void TraitEnabled(Actor self) { if (conditionToken == ConditionManager.InvalidConditionToken) - conditionToken = manager.GrantCondition(self, Info.Condition); + conditionToken = conditionManager.GrantCondition(self, Info.Condition); } protected override void TraitDisabled(Actor self) @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits if (conditionToken == ConditionManager.InvalidConditionToken) return; - conditionToken = manager.RevokeCondition(self, conditionToken); + conditionToken = conditionManager.RevokeCondition(self, conditionToken); } } } \ No newline at end of file diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs index 6f3c672af4..1fd17e11ab 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits readonly GrantConditionOnDamageStateInfo info; readonly Health health; - ConditionManager manager; + ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; public GrantConditionOnDamageState(Actor self, GrantConditionOnDamageStateInfo info) @@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - manager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); GrantUpgradeOnValidDamageState(self, health.DamageState); } @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits if (!info.ValidDamageStates.HasFlag(state) || conditionToken != ConditionManager.InvalidConditionToken) return; - conditionToken = manager.GrantCondition(self, info.Condition); + conditionToken = conditionManager.GrantCondition(self, info.Condition); var sound = info.EnabledSounds.RandomOrDefault(Game.CosmeticRandom); Game.Sound.Play(SoundType.World, sound, self.CenterPosition); @@ -70,14 +70,14 @@ namespace OpenRA.Mods.Common.Traits void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) { var granted = conditionToken != ConditionManager.InvalidConditionToken; - if ((granted && info.GrantPermanently) || manager == null) + if ((granted && info.GrantPermanently) || conditionManager == null) return; if (!granted && !info.ValidDamageStates.HasFlag(e.PreviousDamageState)) GrantUpgradeOnValidDamageState(self, health.DamageState); else if (granted && !info.ValidDamageStates.HasFlag(e.DamageState) && info.ValidDamageStates.HasFlag(e.PreviousDamageState)) { - conditionToken = manager.RevokeCondition(self, conditionToken); + conditionToken = conditionManager.RevokeCondition(self, conditionToken); var sound = info.DisabledSounds.RandomOrDefault(Game.CosmeticRandom); Game.Sound.Play(SoundType.World, sound, self.CenterPosition); diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs index 54230f79e3..a1589781a5 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits readonly Lazy body; DeployState deployState; - ConditionManager manager; + ConditionManager conditionManager; int deployedToken = ConditionManager.InvalidConditionToken; int undeployedToken = ConditionManager.InvalidConditionToken; @@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits public void Created(Actor self) { - manager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); switch (deployState) { @@ -244,15 +244,15 @@ namespace OpenRA.Mods.Common.Traits void OnDeployStarted() { if (undeployedToken != ConditionManager.InvalidConditionToken) - undeployedToken = manager.RevokeCondition(self, undeployedToken); + undeployedToken = conditionManager.RevokeCondition(self, undeployedToken); deployState = DeployState.Deploying; } void OnDeployCompleted() { - if (manager != null && !string.IsNullOrEmpty(info.DeployedCondition) && deployedToken == ConditionManager.InvalidConditionToken) - deployedToken = manager.GrantCondition(self, info.DeployedCondition); + if (conditionManager != null && !string.IsNullOrEmpty(info.DeployedCondition) && deployedToken == ConditionManager.InvalidConditionToken) + deployedToken = conditionManager.GrantCondition(self, info.DeployedCondition); deployState = DeployState.Deployed; } @@ -260,15 +260,15 @@ namespace OpenRA.Mods.Common.Traits void OnUndeployStarted() { if (deployedToken != ConditionManager.InvalidConditionToken) - deployedToken = manager.RevokeCondition(self, deployedToken); + deployedToken = conditionManager.RevokeCondition(self, deployedToken); deployState = DeployState.Deploying; } void OnUndeployCompleted() { - if (manager != null && !string.IsNullOrEmpty(info.UndeployedCondition) && undeployedToken == ConditionManager.InvalidConditionToken) - undeployedToken = manager.GrantCondition(self, info.UndeployedCondition); + if (conditionManager != null && !string.IsNullOrEmpty(info.UndeployedCondition) && undeployedToken == ConditionManager.InvalidConditionToken) + undeployedToken = conditionManager.GrantCondition(self, info.UndeployedCondition); deployState = DeployState.Undeployed; } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs index 2265952abe..6240bf503a 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits { readonly IMove movement; - ConditionManager manager; + ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; public GrantConditionOnMovement(Actor self, GrantConditionOnMovementInfo info) @@ -42,21 +42,21 @@ namespace OpenRA.Mods.Common.Traits protected override void Created(Actor self) { - manager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); base.Created(self); } void ITick.Tick(Actor self) { - if (manager == null) + if (conditionManager == null) return; var isMovingVertically = Info.ConsiderVerticalMovement ? movement.IsMovingVertically : false; var isMoving = !IsTraitDisabled && !self.IsDead && (movement.IsMoving || isMovingVertically); if (isMoving && conditionToken == ConditionManager.InvalidConditionToken) - conditionToken = manager.GrantCondition(self, Info.Condition); + conditionToken = conditionManager.GrantCondition(self, Info.Condition); else if (!isMoving && conditionToken != ConditionManager.InvalidConditionToken) - conditionToken = manager.RevokeCondition(self, conditionToken); + conditionToken = conditionManager.RevokeCondition(self, conditionToken); } } } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs index 97f53640be..315e94509b 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits { readonly GrantConditionOnTerrainInfo info; - ConditionManager manager; + ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; string previousTerrain; @@ -43,12 +43,12 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { - manager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); } public void Tick(Actor self) { - if (manager == null) + if (conditionManager == null) return; var currentTerrain = self.World.Map.GetTerrainInfo(self.Location).Type; @@ -56,9 +56,9 @@ namespace OpenRA.Mods.Common.Traits if (currentTerrain != previousTerrain) { if (wantsGranted && conditionToken == ConditionManager.InvalidConditionToken) - conditionToken = manager.GrantCondition(self, info.Condition); + conditionToken = conditionManager.GrantCondition(self, info.Condition); else if (!wantsGranted && conditionToken != ConditionManager.InvalidConditionToken) - conditionToken = manager.RevokeCondition(self, conditionToken); + conditionToken = conditionManager.RevokeCondition(self, conditionToken); } previousTerrain = currentTerrain; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs index 2d7d879191..4e454d6883 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs @@ -108,9 +108,9 @@ namespace OpenRA.Mods.Common.Traits if (!info.ValidStances.HasStance(stance)) return; - var um = a.TraitOrDefault(); - if (um != null && !tokens.ContainsKey(a) && um.AcceptsExternalCondition(a, info.Condition)) - tokens[a] = um.GrantCondition(a, info.Condition, true); + var cm = a.TraitOrDefault(); + if (cm != null && !tokens.ContainsKey(a) && cm.AcceptsExternalCondition(a, info.Condition)) + tokens[a] = cm.GrantCondition(a, info.Condition, true); } public void UnitProducedByOther(Actor self, Actor producer, Actor produced) @@ -130,9 +130,9 @@ namespace OpenRA.Mods.Common.Traits if (!info.ValidStances.HasStance(stance)) return; - var um = produced.TraitOrDefault(); - if (um != null && um.AcceptsExternalCondition(produced, info.Condition)) - tokens[produced] = um.GrantCondition(produced, info.Condition, true); + var cm = produced.TraitOrDefault(); + if (cm != null && cm.AcceptsExternalCondition(produced, info.Condition)) + tokens[produced] = cm.GrantCondition(produced, info.Condition, true); } } @@ -146,9 +146,9 @@ namespace OpenRA.Mods.Common.Traits return; tokens.Remove(a); - var um = a.TraitOrDefault(); - if (um != null) - um.RevokeCondition(a, token); + var cm = a.TraitOrDefault(); + if (cm != null) + cm.RevokeCondition(a, token); } } } diff --git a/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs b/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs index 147ca4c860..8c178a2f9b 100644 --- a/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs @@ -36,11 +36,11 @@ namespace OpenRA.Mods.Common.Warheads if (!IsValidAgainst(a, firedBy)) continue; - var um = a.TraitOrDefault(); + var cm = a.TraitOrDefault(); // Condition token is ignored because we never revoke this condition. - if (um != null && um.AcceptsExternalCondition(a, Condition)) - um.GrantCondition(a, Condition, true, Duration); + if (cm != null && cm.AcceptsExternalCondition(a, Condition)) + cm.GrantCondition(a, Condition, true, Duration); } } } diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 6c7ac23bab..237230e7a8 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.D2k.Activities readonly Target target; readonly Sandworm sandworm; - readonly ConditionManager manager; + readonly ConditionManager conditionManager; readonly WeaponInfo weapon; readonly RadarPings radarPings; readonly AttackSwallow swallow; @@ -46,7 +46,7 @@ namespace OpenRA.Mods.D2k.Activities sandworm = self.Trait(); positionable = self.Trait(); swallow = self.Trait(); - manager = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); radarPings = self.World.WorldActor.TraitOrDefault(); } @@ -109,9 +109,9 @@ namespace OpenRA.Mods.D2k.Activities stance = AttackState.Burrowed; countdown = swallow.Info.AttackDelay; burrowLocation = self.Location; - if (manager != null && attackingToken == ConditionManager.InvalidConditionToken && + if (conditionManager != null && attackingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(swallow.Info.AttackingCondition)) - attackingToken = manager.GrantCondition(self, swallow.Info.AttackingCondition); + attackingToken = conditionManager.GrantCondition(self, swallow.Info.AttackingCondition); break; case AttackState.Burrowed: if (--countdown > 0) @@ -171,7 +171,7 @@ namespace OpenRA.Mods.D2k.Activities void RevokeCondition(Actor self) { if (attackingToken != ConditionManager.InvalidConditionToken) - attackingToken = manager.RevokeCondition(self, attackingToken); + attackingToken = conditionManager.RevokeCondition(self, attackingToken); } } } diff --git a/OpenRA.Mods.RA/Traits/Disguise.cs b/OpenRA.Mods.RA/Traits/Disguise.cs index f3e6b64118..7d3d97c0f6 100644 --- a/OpenRA.Mods.RA/Traits/Disguise.cs +++ b/OpenRA.Mods.RA/Traits/Disguise.cs @@ -83,7 +83,7 @@ namespace OpenRA.Mods.RA.Traits readonly Actor self; readonly DisguiseInfo info; - ConditionManager um; + ConditionManager conditionManager; int disguisedToken = ConditionManager.InvalidConditionToken; public Disguise(Actor self, DisguiseInfo info) @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.Traits void INotifyCreated.Created(Actor self) { - um = self.TraitOrDefault(); + conditionManager = self.TraitOrDefault(); } public IEnumerable Orders @@ -187,12 +187,12 @@ namespace OpenRA.Mods.RA.Traits foreach (var t in self.TraitsImplementing()) t.OnEffectiveOwnerChanged(self, oldEffectiveOwner, AsPlayer); - if (Disguised != oldDisguiseSetting && um != null) + if (Disguised != oldDisguiseSetting && conditionManager != null) { if (Disguised && disguisedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.DisguisedCondition)) - disguisedToken = um.GrantCondition(self, info.DisguisedCondition); + disguisedToken = conditionManager.GrantCondition(self, info.DisguisedCondition); else if (!Disguised && disguisedToken != ConditionManager.InvalidConditionToken) - disguisedToken = um.RevokeCondition(self, disguisedToken); + disguisedToken = conditionManager.RevokeCondition(self, disguisedToken); } } From cb9178364fb578ae37e5a3293e383b39123d953b Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:06:22 +0000 Subject: [PATCH 03/11] Change upgradeAvailable to instancesEnabled in SupportPowerManager. --- .../Traits/SupportPowers/SupportPowerManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 228a689d22..072edc4ae1 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -160,12 +160,12 @@ namespace OpenRA.Mods.Common.Traits public int RemainingTime; public int TotalTime; public bool Active { get; private set; } - public bool Disabled { get { return !prereqsAvailable || !upgradeAvailable; } } + public bool Disabled { get { return !prereqsAvailable || !instancesEnabled; } } public SupportPowerInfo Info { get { return Instances.Select(i => i.Info).FirstOrDefault(); } } public bool Ready { get { return Active && RemainingTime == 0; } } - bool upgradeAvailable; + bool instancesEnabled; bool prereqsAvailable = true; public SupportPowerInstance(string key, SupportPowerManager manager) @@ -188,8 +188,8 @@ namespace OpenRA.Mods.Common.Traits bool notifiedReady; public void Tick() { - upgradeAvailable = Instances.Any(i => !i.IsTraitDisabled); - if (!upgradeAvailable) + instancesEnabled = Instances.Any(i => !i.IsTraitDisabled); + if (!instancesEnabled) RemainingTime = TotalTime; Active = !Disabled && Instances.Any(i => !i.Self.IsDisabled()); From 15b465c1e25af4b8d95434fcf3cd2cc239801ea9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:07:35 +0000 Subject: [PATCH 04/11] Change DeployToUpgrade order to GrantConditionOnDeploy. --- .../Traits/Upgrades/GrantConditionOnDeploy.cs | 6 +++--- OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs index a1589781a5..296e217418 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs @@ -119,13 +119,13 @@ namespace OpenRA.Mods.Common.Traits public IEnumerable Orders { - get { yield return new DeployOrderTargeter("DeployToUpgrade", 5, + get { yield return new DeployOrderTargeter("GrantConditionOnDeploy", 5, () => IsCursorBlocked() ? info.DeployBlockedCursor : info.DeployCursor); } } public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) { - if (order.OrderID == "DeployToUpgrade") + if (order.OrderID == "GrantConditionOnDeploy") return new Order(order.OrderID, self, queued); return null; @@ -133,7 +133,7 @@ namespace OpenRA.Mods.Common.Traits public void ResolveOrder(Actor self, Order order) { - if (order.OrderString != "DeployToUpgrade" || deployState == DeployState.Deploying || deployState == DeployState.Undeploying) + if (order.OrderString != "GrantConditionOnDeploy" || deployState == DeployState.Deploying || deployState == DeployState.Undeploying) return; if (!order.Queued) diff --git a/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs b/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs index e5c6947f20..d24dd82984 100644 --- a/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs @@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Widgets PerformKeyboardOrderOnSelection(a => new Order("DeployTransform", a, false)); PerformKeyboardOrderOnSelection(a => new Order("Unload", a, false)); PerformKeyboardOrderOnSelection(a => new Order("Detonate", a, false)); - PerformKeyboardOrderOnSelection(a => new Order("DeployToUpgrade", a, false)); + PerformKeyboardOrderOnSelection(a => new Order("GrantConditionOnDeploy", a, false)); return true; } From 0cf60456a5185367d8c50c50ef072d3e26ef7ebd Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:09:08 +0000 Subject: [PATCH 05/11] Remove upgrade shim code. --- .../Traits/Upgrades/ConditionManager.cs | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs index d219297ee8..11940b4fd4 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs @@ -74,9 +74,6 @@ namespace OpenRA.Mods.Common.Traits int nextToken = 1; - /// Temporary shim between the old and new upgrade/condition grant and revoke methods. - readonly Dictionary, int> objectTokenShim = new Dictionary, int>(); - /// Cache of condition -> enabled state for quick evaluation of boolean conditions. readonly Dictionary conditionCache = new Dictionary(); @@ -267,53 +264,5 @@ namespace OpenRA.Mods.Common.Traits timersToRemove.Clear(); } - - #region Shim methods for legacy upgrade granting code - - void CheckCanManageConditions() - { - if (state == null) - throw new InvalidOperationException("Conditions cannot be managed until the actor has been fully created."); - } - - public void GrantTimedUpgrade(Actor self, string upgrade, int duration, object source = null, int dupesAllowed = 1) - { - CheckCanManageConditions(); - var token = GrantCondition(self, upgrade, false, duration); - if (source != null) - objectTokenShim[Pair.New(source, upgrade)] = token; - } - - public void GrantUpgrade(Actor self, string upgrade, object source) - { - CheckCanManageConditions(); - objectTokenShim[Pair.New(source, upgrade)] = GrantCondition(self, upgrade); - } - - public void RevokeUpgrade(Actor self, string upgrade, object source) - { - CheckCanManageConditions(); - RevokeCondition(self, objectTokenShim[Pair.New(source, upgrade)]); - } - - /// Returns true if the actor uses the given upgrade. Does not check the actual level of the upgrade. - public bool AcknowledgesUpgrade(Actor self, string upgrade) - { - CheckCanManageConditions(); - return state.ContainsKey(upgrade); - } - - /// Returns true only if the actor can accept another level of the upgrade. - public bool AcceptsUpgrade(Actor self, string upgrade) - { - CheckCanManageConditions(); - bool enabled; - if (!conditionCache.TryGetValue(upgrade, out enabled)) - return false; - - return !enabled; - } - - #endregion } } From 9e70c3f497f1758a64538910f95dd7031aa5c809 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:11:07 +0000 Subject: [PATCH 06/11] Rename GrantUpgradeOnValidDamageState. --- .../Traits/Upgrades/GrantConditionOnDamageState.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs index 1fd17e11ab..f8e8a40ae9 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs @@ -53,10 +53,10 @@ namespace OpenRA.Mods.Common.Traits void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault(); - GrantUpgradeOnValidDamageState(self, health.DamageState); + GrantConditionOnValidDamageState(self, health.DamageState); } - void GrantUpgradeOnValidDamageState(Actor self, DamageState state) + void GrantConditionOnValidDamageState(Actor self, DamageState state) { if (!info.ValidDamageStates.HasFlag(state) || conditionToken != ConditionManager.InvalidConditionToken) return; @@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits return; if (!granted && !info.ValidDamageStates.HasFlag(e.PreviousDamageState)) - GrantUpgradeOnValidDamageState(self, health.DamageState); + GrantConditionOnValidDamageState(self, health.DamageState); else if (granted && !info.ValidDamageStates.HasFlag(e.DamageState) && info.ValidDamageStates.HasFlag(e.PreviousDamageState)) { conditionToken = conditionManager.RevokeCondition(self, conditionToken); From c8afbb16bacea48857c5a96234275e67fde1e466 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:13:20 +0000 Subject: [PATCH 07/11] Rename prerequisite watcher key prefix. --- .../Traits/Player/GrantConditionOnPrerequisiteManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs b/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs index 5328c3ec1b..3ef192cb66 100644 --- a/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs +++ b/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits static string MakeKey(string[] prerequisites) { - return "upgrade_" + string.Join("_", prerequisites.OrderBy(a => a)); + return "condition_" + string.Join("_", prerequisites.OrderBy(a => a)); } public void Register(Actor actor, GrantConditionOnPrerequisite u, string[] prerequisites) From 152ae13cea25435da2d6137e1c84adec5e1b0ef1 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:14:36 +0000 Subject: [PATCH 08/11] Rename SelectUpgradeTarget. --- .../Traits/SupportPowers/GrantExternalConditionPower.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index ec17c31f20..409f30c7bb 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits public override void SelectTarget(Actor self, string order, SupportPowerManager manager) { Game.Sound.PlayToPlayer(SoundType.World, manager.Self.Owner, Info.SelectTargetSound); - self.World.OrderGenerator = new SelectUpgradeTarget(Self.World, order, manager, this); + self.World.OrderGenerator = new SelectConditionTarget(Self.World, order, manager, this); } public override void Activate(Actor self, Order order, SupportPowerManager manager) @@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits }); } - class SelectUpgradeTarget : IOrderGenerator + class SelectConditionTarget : IOrderGenerator { readonly GrantExternalConditionPower power; readonly int range; From d0270ab866284872b46f48fea19d5f229432a213 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:17:02 +0000 Subject: [PATCH 09/11] Rename comments and documentation. --- OpenRA.Mods.Common/Lint/CheckConditions.cs | 2 +- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 4 ++-- .../Crates/GrantExternalConditionCrateAction.cs | 4 ++-- .../Traits/Crates/LevelUpCrateAction.cs | 4 ++-- OpenRA.Mods.Common/Traits/GainsExperience.cs | 2 +- OpenRA.Mods.Common/Traits/Plug.cs | 2 +- .../Traits/Render/TimedConditionBar.cs | 2 +- .../Traits/Render/WithIdleAnimation.cs | 2 +- .../Traits/Render/WithSpriteBody.cs | 2 +- .../SupportPowers/GrantExternalConditionPower.cs | 4 ++-- .../Traits/Upgrades/ConditionManager.cs | 2 +- .../Traits/Upgrades/DisableOnCondition.cs | 2 +- .../Upgrades/GrantConditionOnDamageState.cs | 4 ++-- .../Traits/Upgrades/GrantConditionOnDeploy.cs | 15 +++++++-------- .../Traits/Upgrades/GrantConditionOnMovement.cs | 2 +- .../Traits/Upgrades/GrantConditionOnTerrain.cs | 2 +- .../Traits/Upgrades/ProximityExternalCondition.cs | 12 ++++++------ .../Traits/Upgrades/UpgradableTrait.cs | 6 +++--- 18 files changed, 36 insertions(+), 37 deletions(-) diff --git a/OpenRA.Mods.Common/Lint/CheckConditions.cs b/OpenRA.Mods.Common/Lint/CheckConditions.cs index 1883741101..4f15bed87a 100644 --- a/OpenRA.Mods.Common/Lint/CheckConditions.cs +++ b/OpenRA.Mods.Common/Lint/CheckConditions.cs @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Lint emitError("Actor type `{0}` consumes conditions that are not granted: {1}".F(actorInfo.Key, ungranted.JoinWith(", "))); if ((consumed.Any() || granted.Any()) && actorInfo.Value.TraitInfoOrDefault() == null) - emitError("Actor type `{0}` defines conditions but does not include an UpgradeManager".F(actorInfo.Key)); + emitError("Actor type `{0}` defines conditions but does not include a ConditionManager".F(actorInfo.Key)); } } } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index d7831a1e2b..cbc8e97733 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -661,7 +661,7 @@ namespace OpenRA.Mods.Common.Traits OnAirborneAltitudeLeft(); } - #region Airborne upgrades + #region Airborne conditions void OnAirborneAltitudeReached() { @@ -685,7 +685,7 @@ namespace OpenRA.Mods.Common.Traits #endregion - #region Cruising upgrades + #region Cruising conditions void OnCruisingAltitudeReached() { diff --git a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs index a8d2a8c695..b1d61bdf79 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs @@ -14,14 +14,14 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [Desc("Grants an upgrade to the collector.")] + [Desc("Grants a condition on the collector.")] public class GrantExternalConditionCrateActionInfo : CrateActionInfo { [FieldLoader.Require] [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] public readonly string Condition = null; - [Desc("Duration of the upgrade (in ticks). Set to 0 for a permanent upgrade.")] + [Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")] public readonly int Duration = 0; [Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")] diff --git a/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs index dfc026fd05..ef212a608f 100644 --- a/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs @@ -50,11 +50,11 @@ namespace OpenRA.Mods.Common.Traits { var inRange = self.World.FindActorsInCircle(self.CenterPosition, info.Range).Where(a => { - // Don't upgrade the same unit twice + // Don't touch the same unit twice if (a == collector) return false; - // Only upgrade the collecting player's units + // Only affect the collecting player's units // TODO: Also apply to allied units? if (a.Owner != collector.Owner) return false; diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index e84501d087..228e16ec83 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits [FieldLoader.Require] [Desc("Condition to grant at each level.", "Key is the XP requirements for each level as a percentage of our own value.", - "Value is a list of the upgrade types to grant")] + "Value is the condition to grant.")] public readonly Dictionary Conditions = null; [GrantedConditionReference] diff --git a/OpenRA.Mods.Common/Traits/Plug.cs b/OpenRA.Mods.Common/Traits/Plug.cs index a17349043b..7ac97b50e4 100644 --- a/OpenRA.Mods.Common/Traits/Plug.cs +++ b/OpenRA.Mods.Common/Traits/Plug.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits public class PlugInfo : TraitInfo { [FieldLoader.Require] - [Desc("Plug type (matched against Upgrades in Pluggable)")] + [Desc("Plug type (matched against Conditions in Pluggable)")] public readonly string Type = null; } diff --git a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs index 03c7e666bd..21817c0e16 100644 --- a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { - [Desc("Visualizes the remaining time for an upgrade.")] + [Desc("Visualizes the remaining time for a condition.")] class TimedConditionBarInfo : ITraitInfo, Requires { [FieldLoader.Require] diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs index 98f6e9efdb..9236dabb4c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly int Interval = 750; - [Desc("Pause when the actor is disabled. Deprecated. Use upgrades instead.")] + [Desc("Pause when the actor is disabled. Deprecated. Use conditions instead.")] public readonly bool PauseOnLowPower = false; public override object Create(ActorInitializer init) { return new WithIdleAnimation(init.Self, this); } diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index 26bc9af9cc..c4a4eb1561 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits.Render DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); } - // TODO: Get rid of INotifyBuildComplete in favor of using the upgrade system + // TODO: Get rid of INotifyBuildComplete in favor of using the condition system void INotifyBuildComplete.BuildingComplete(Actor self) { OnBuildComplete(self); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index 409f30c7bb..b6af4a9c3e 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] public readonly string Condition = null; - [Desc("Duration of the upgrade (in ticks). Set to 0 for a permanent condition.")] + [Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")] public readonly int Duration = 0; [Desc("Cells - affects whole cells only")] @@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits readonly SupportPowerManager manager; readonly string order; - public SelectUpgradeTarget(World world, string order, SupportPowerManager manager, GrantExternalConditionPower power) + public SelectConditionTarget(World world, string order, SupportPowerManager manager, GrantExternalConditionPower power) { // Clear selection if using Left-Click Orders if (Game.Settings.Game.UseClassicMouseStyle) diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs index 11940b4fd4..26e49a9eec 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits void Update(int duration, int remaining); } - [Desc("Attach this to a unit to enable dynamic upgrades by warheads, experience, crates, support powers, etc.")] + [Desc("Attach this to a unit to enable dynamic conditions by warheads, experience, crates, support powers, etc.")] public class ConditionManagerInfo : TraitInfo, Requires { } public class ConditionManager : INotifyCreated, ITick diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs index 225fd5d461..e310d83b89 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [Desc("Disable the actor when this trait is enabled by an upgrade.")] + [Desc("Disable the actor when this trait is enabled by a condition.")] public class DisableOnConditionInfo : UpgradableTraitInfo { public override object Create(ActorInitializer init) { return new DisableOnCondition(this); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs index f8e8a40ae9..4d13b6d778 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [Desc("Applies an upgrade to the actor at specified damage states.")] + [Desc("Applies a condition to the actor at specified damage states.")] public class GrantConditionOnDamageStateInfo : ITraitInfo, Requires { [FieldLoader.Require] @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Play a random sound from this list when disabled.")] public readonly string[] DisabledSounds = { }; - [Desc("Levels of damage at which to grant upgrades.")] + [Desc("Levels of damage at which to grant the condition.")] public readonly DamageState ValidDamageStates = DamageState.Heavy | DamageState.Critical; [Desc("Is the condition irrevocable once it has been activated?")] diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs index 296e217418..18455ff0b7 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs @@ -30,8 +30,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("The condition to grant after deploying and revoke before undeploying.")] public readonly string DeployedCondition = null; - [Desc("The terrain types that this actor can deploy on to receive these upgrades. " + - "Leave empty to allow any.")] + [Desc("The terrain types that this actor can deploy on. Leave empty to allow any.")] public readonly HashSet AllowedTerrainTypes = new HashSet(); [Desc("Can this actor deploy on slopes?")] @@ -207,19 +206,19 @@ namespace OpenRA.Mods.Common.Traits if (!string.IsNullOrEmpty(info.DeploySound)) Game.Sound.Play(SoundType.World, info.DeploySound, self.CenterPosition); - // Revoke upgrades that are used while undeployed. + // Revoke condition that is applied while undeployed. if (!init) OnDeployStarted(); - // If there is no animation to play just grant the upgrades that are used while deployed. - // Alternatively, play the deploy animation and then grant the upgrades. + // If there is no animation to play just grant the condition that is used while deployed. + // Alternatively, play the deploy animation and then grant the condition. if (string.IsNullOrEmpty(info.DeployAnimation) || body.Value == null) OnDeployCompleted(); else body.Value.PlayCustomAnimation(self, info.DeployAnimation, OnDeployCompleted); } - /// Play undeploy sound and animation and after that revoke the upgrades. + /// Play undeploy sound and animation and after that revoke the condition. void Undeploy() { Undeploy(false); } void Undeploy(bool init) { @@ -233,8 +232,8 @@ namespace OpenRA.Mods.Common.Traits if (!init) OnUndeployStarted(); - // If there is no animation to play just grant the upgrades that are used while undeployed. - // Alternatively, play the undeploy animation and then grant the upgrades. + // If there is no animation to play just grant the condition that is used while undeployed. + // Alternatively, play the undeploy animation and then grant the condition. if (string.IsNullOrEmpty(info.DeployAnimation) || body.Value == null) OnUndeployCompleted(); else diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs index 6240bf503a..e99784af06 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Condition to grant.")] public readonly string Condition = null; - [Desc("Apply upgrades on straight vertical movement as well.")] + [Desc("Apply condition on straight vertical movement as well.")] public readonly bool ConsiderVerticalMovement = false; public override object Create(ActorInitializer init) { return new GrantConditionOnMovement(init.Self, this); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs index 315e94509b..d942fc7990 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Condition = null; [FieldLoader.Require] - [Desc("Terrain names to trigger the upgrade.")] + [Desc("Terrain names to trigger the condition.")] public readonly string[] TerrainTypes = { }; public object Create(ActorInitializer init) { return new GrantConditionOnTerrain(init, this); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs index 4e454d6883..6dab83061e 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs @@ -14,24 +14,24 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [Desc("Applies an upgrade to actors within a specified range.")] + [Desc("Applies a condition to actors within a specified range.")] public class ProximityExternalConditionInfo : ITraitInfo { [FieldLoader.Require] [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] public readonly string Condition = null; - [Desc("The range to search for actors to upgrade.")] + [Desc("The range to search for actors.")] public readonly WDist Range = WDist.FromCells(3); - [Desc("The maximum vertical range above terrain to search for actors to upgrade.", - "Ignored if 0 (actors are upgraded regardless of vertical distance).")] + [Desc("The maximum vertical range above terrain to search for actors.", + "Ignored if 0 (actors are selected regardless of vertical distance).")] public readonly WDist MaximumVerticalOffset = WDist.Zero; [Desc("What diplomatic stances are affected.")] public readonly Stance ValidStances = Stance.Ally; - [Desc("Grant the upgrades apply to this actor.")] + [Desc("Condition is applied permanently to this actor.")] public readonly bool AffectsParent = false; public readonly string EnableSound = null; @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits if (produced.OccupiesSpace == null) return; - // We don't grant upgrades when disabled + // We don't grant conditions when disabled if (self.IsDisabled()) return; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs b/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs index fb4247c00c..0033635bbb 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public abstract object Create(ActorInitializer init); // HACK: A shim for all the ActorPreview code that used to query UpgradeMinEnabledLevel directly - // This can go away after we introduce an InitialUpgrades ActorInit and have the traits query the + // This can go away after we introduce an InitialConditions ActorInit and have the traits query the // condition directly public bool EnabledByDefault { get; private set; } @@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Traits } /// - /// Abstract base for enabling and disabling trait using upgrades. + /// Abstract base for enabling and disabling trait using conditions. /// Requires basing *Info on UpgradableTraitInfo and using base(info) constructor. - /// Note that EnabledByUpgrade is not called at creation even if this starts as enabled. + /// TraitEnabled will be called at creation if the trait starts enabled or does not use conditions. /// public abstract class UpgradableTrait : IConditionConsumer, IDisabledTrait, INotifyCreated, ISync where InfoType : UpgradableTraitInfo { From 268ed016ab3f75676f7cc562a0fd292b89d121bc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 23:28:34 +0000 Subject: [PATCH 10/11] Rename UpgradableTrait to ConditionalTrait. --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 2 +- OpenRA.Mods.Common/Traits/AffectsShroud.cs | 4 ++-- OpenRA.Mods.Common/Traits/Armament.cs | 4 ++-- OpenRA.Mods.Common/Traits/Armor.cs | 4 ++-- OpenRA.Mods.Common/Traits/Attack/AttackBase.cs | 4 ++-- OpenRA.Mods.Common/Traits/AutoTarget.cs | 4 ++-- OpenRA.Mods.Common/Traits/BlocksProjectiles.cs | 4 ++-- OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs | 4 ++-- OpenRA.Mods.Common/Traits/Carryable.cs | 4 ++-- OpenRA.Mods.Common/Traits/Cloak.cs | 4 ++-- OpenRA.Mods.Common/Traits/DamagedByTerrain.cs | 4 ++-- OpenRA.Mods.Common/Traits/DetectCloaked.cs | 4 ++-- OpenRA.Mods.Common/Traits/KillsSelf.cs | 4 ++-- OpenRA.Mods.Common/Traits/Mobile.cs | 4 ++-- OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs | 4 ++-- OpenRA.Mods.Common/Traits/Multipliers/DamageMultiplier.cs | 4 ++-- .../Traits/Multipliers/FirepowerMultiplier.cs | 4 ++-- .../Traits/Multipliers/InaccuracyMultiplier.cs | 4 ++-- OpenRA.Mods.Common/Traits/Multipliers/PowerMultiplier.cs | 4 ++-- OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs | 4 ++-- .../Traits/Multipliers/ReloadDelayMultiplier.cs | 4 ++-- OpenRA.Mods.Common/Traits/Multipliers/SpeedMultiplier.cs | 4 ++-- OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs | 4 ++-- OpenRA.Mods.Common/Traits/Power/Power.cs | 4 ++-- OpenRA.Mods.Common/Traits/Power/RequiresPower.cs | 4 ++-- OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs | 4 ++-- OpenRA.Mods.Common/Traits/RejectsOrders.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/Hovers.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithDecoration.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithParachute.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithShadow.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithSpriteBarrel.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithSpriteTurret.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs | 4 ++-- OpenRA.Mods.Common/Traits/SeedsResource.cs | 4 ++-- OpenRA.Mods.Common/Traits/SelfHealing.cs | 4 ++-- OpenRA.Mods.Common/Traits/Sellable.cs | 4 ++-- OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs | 4 ++-- OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs | 4 ++-- OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs | 4 ++-- OpenRA.Mods.Common/Traits/Targetable.cs | 4 ++-- OpenRA.Mods.Common/Traits/Tooltip.cs | 4 ++-- .../Upgrades/{UpgradableTrait.cs => ConditionalTrait.cs} | 6 +++--- OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs | 4 ++-- OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs | 4 ++-- .../Traits/Upgrades/GrantConditionOnMovement.cs | 4 ++-- OpenRA.Mods.Common/Traits/Wanders.cs | 4 ++-- OpenRA.Mods.D2k/Traits/AttractsWorms.cs | 4 ++-- 57 files changed, 114 insertions(+), 114 deletions(-) rename OpenRA.Mods.Common/Traits/Upgrades/{UpgradableTrait.cs => ConditionalTrait.cs} (91%) diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 8bce13f6df..ab3f66453e 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -493,7 +493,7 @@ - + diff --git a/OpenRA.Mods.Common/Traits/AffectsShroud.cs b/OpenRA.Mods.Common/Traits/AffectsShroud.cs index f5e1f71741..1e483bd5e5 100644 --- a/OpenRA.Mods.Common/Traits/AffectsShroud.cs +++ b/OpenRA.Mods.Common/Traits/AffectsShroud.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public abstract class AffectsShroudInfo : UpgradableTraitInfo + public abstract class AffectsShroudInfo : ConditionalTraitInfo { public readonly WDist Range = WDist.Zero; @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public readonly VisibilityType Type = VisibilityType.Footprint; } - public abstract class AffectsShroud : UpgradableTrait, ITick, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld + public abstract class AffectsShroud : ConditionalTrait, ITick, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld { static readonly PPos[] NoCells = { }; diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index a3af586e38..2bc595dd2c 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits } [Desc("Allows you to attach weapons to the unit (use @IdentifierSuffix for > 1)")] - public class ArmamentInfo : UpgradableTraitInfo, Requires + public class ArmamentInfo : ConditionalTraitInfo, Requires { public readonly string Name = "primary"; @@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Traits } } - public class Armament : UpgradableTrait, ITick, IExplodeModifier + public class Armament : ConditionalTrait, ITick, IExplodeModifier { public readonly WeaponInfo Weapon; public readonly Barrel[] Barrels; diff --git a/OpenRA.Mods.Common/Traits/Armor.cs b/OpenRA.Mods.Common/Traits/Armor.cs index 161800afab..49cb10b603 100644 --- a/OpenRA.Mods.Common/Traits/Armor.cs +++ b/OpenRA.Mods.Common/Traits/Armor.cs @@ -12,14 +12,14 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Used to define weapon efficiency modifiers with different percentages per Type.")] - public class ArmorInfo : UpgradableTraitInfo + public class ArmorInfo : ConditionalTraitInfo { public readonly string Type = null; public override object Create(ActorInitializer init) { return new Armor(init.Self, this); } } - public class Armor : UpgradableTrait + public class Armor : ConditionalTrait { public Armor(Actor self, ArmorInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index a5dc0457a8..24fe1f9c4c 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -19,7 +19,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public abstract class AttackBaseInfo : UpgradableTraitInfo + public abstract class AttackBaseInfo : ConditionalTraitInfo { [Desc("Armament names")] public readonly string[] Armaments = { "primary", "secondary" }; @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits public override abstract object Create(ActorInitializer init); } - public abstract class AttackBase : UpgradableTrait, IIssueOrder, IResolveOrder, IOrderVoice, ISync + public abstract class AttackBase : ConditionalTrait, IIssueOrder, IResolveOrder, IOrderVoice, ISync { readonly string attackOrderName = "Attack"; readonly string forceAttackOrderName = "ForceAttack"; diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index 7f9e5b99e4..3d6c4b0c2c 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("The actor will automatically engage the enemy when it is in range.")] - public class AutoTargetInfo : UpgradableTraitInfo, Requires, UsesInit + public class AutoTargetInfo : ConditionalTraitInfo, Requires, UsesInit { [Desc("It will try to hunt down the enemy if it is not set to defend.")] public readonly bool AllowMovement = true; @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public enum UnitStance { HoldFire, ReturnFire, Defend, AttackAnything } - public class AutoTarget : UpgradableTrait, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync + public class AutoTarget : ConditionalTrait, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync { readonly AttackBase[] attackBases; readonly AttackFollow[] attackFollows; diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs index b288848b56..d3c2228cc6 100644 --- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs +++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs @@ -21,14 +21,14 @@ namespace OpenRA.Mods.Common.Traits } [Desc("This actor blocks bullets and missiles with 'Blockable' property.")] - public class BlocksProjectilesInfo : UpgradableTraitInfo + public class BlocksProjectilesInfo : ConditionalTraitInfo { public readonly WDist Height = WDist.FromCells(1); public override object Create(ActorInitializer init) { return new BlocksProjectiles(init.Self, this); } } - public class BlocksProjectiles : UpgradableTrait, IBlocksProjectiles + public class BlocksProjectiles : ConditionalTrait, IBlocksProjectiles { public BlocksProjectiles(Actor self, BlocksProjectilesInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index 64f95b852f..a8dc50409a 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Building can be repaired by the repair button.")] - public class RepairableBuildingInfo : UpgradableTraitInfo, Requires + public class RepairableBuildingInfo : ConditionalTraitInfo, Requires { public readonly int RepairPercent = 20; public readonly int RepairInterval = 24; @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); } } - public class RepairableBuilding : UpgradableTrait, ITick + public class RepairableBuilding : ConditionalTrait, ITick { [Sync] public int RepairersHash diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index b368707095..02c2654d24 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Can be carried by actors with the `Carryall` trait.")] - public class CarryableInfo : UpgradableTraitInfo + public class CarryableInfo : ConditionalTraitInfo { [GrantedConditionReference] [Desc("The condition to grant to self while a carryall has been reserved.")] @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Carryable(init.Self, this); } } - public class Carryable : UpgradableTrait + public class Carryable : ConditionalTrait { ConditionManager conditionManager; int reservedToken = ConditionManager.InvalidConditionToken; diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 44ac320395..4486ac8021 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits } [Desc("This unit can cloak and uncloak in specific situations.")] - public class CloakInfo : UpgradableTraitInfo + public class CloakInfo : ConditionalTraitInfo { [Desc("Measured in game ticks.")] public readonly int InitialDelay = 10; @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Cloak(this); } } - public class Cloak : UpgradableTrait, IRenderModifier, INotifyDamage, + public class Cloak : ConditionalTrait, IRenderModifier, INotifyDamage, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyCreated, INotifyHarvesterAction { [Sync] int remainingTime; diff --git a/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs b/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs index a9a0a72020..fef89e5ba1 100644 --- a/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs +++ b/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("This actor receives damage from the given weapon when on the specified terrain type.")] - class DamagedByTerrainInfo : UpgradableTraitInfo, Requires + class DamagedByTerrainInfo : ConditionalTraitInfo, Requires { [Desc("Amount of damage received per DamageInterval ticks.")] [FieldLoader.Require] public readonly int Damage = 0; @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new DamagedByTerrain(init.Self, this); } } - class DamagedByTerrain : UpgradableTrait, ITick, ISync, INotifyAddedToWorld + class DamagedByTerrain : ConditionalTrait, ITick, ISync, INotifyAddedToWorld { readonly Health health; diff --git a/OpenRA.Mods.Common/Traits/DetectCloaked.cs b/OpenRA.Mods.Common/Traits/DetectCloaked.cs index 7a357ed7fc..b7270f62a4 100644 --- a/OpenRA.Mods.Common/Traits/DetectCloaked.cs +++ b/OpenRA.Mods.Common/Traits/DetectCloaked.cs @@ -14,7 +14,7 @@ using System.Collections.Generic; namespace OpenRA.Mods.Common.Traits { [Desc("Actor can reveal Cloak actors in a specified range.")] - public class DetectCloakedInfo : UpgradableTraitInfo + public class DetectCloakedInfo : ConditionalTraitInfo { [Desc("Specific cloak classifications I can reveal.")] public readonly HashSet CloakTypes = new HashSet { "Cloak" }; @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new DetectCloaked(this); } } - public class DetectCloaked : UpgradableTrait + public class DetectCloaked : ConditionalTrait { public DetectCloaked(DetectCloakedInfo info) : base(info) { } } diff --git a/OpenRA.Mods.Common/Traits/KillsSelf.cs b/OpenRA.Mods.Common/Traits/KillsSelf.cs index 65365028a5..10a8c472c4 100644 --- a/OpenRA.Mods.Common/Traits/KillsSelf.cs +++ b/OpenRA.Mods.Common/Traits/KillsSelf.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - class KillsSelfInfo : UpgradableTraitInfo + class KillsSelfInfo : ConditionalTraitInfo { [Desc("Remove the actor from the world (and destroy it) instead of killing it.")] public readonly bool RemoveInstead = false; @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new KillsSelf(this); } } - class KillsSelf : UpgradableTrait, INotifyAddedToWorld + class KillsSelf : ConditionalTrait, INotifyAddedToWorld { public KillsSelf(KillsSelfInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 2f3fc2d0d1..eeff82ff16 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits } [Desc("Unit is able to move.")] - public class MobileInfo : UpgradableTraitInfo, IMoveInfo, IPositionableInfo, IOccupySpaceInfo, IFacingInfo, + public class MobileInfo : ConditionalTraitInfo, IMoveInfo, IPositionableInfo, IOccupySpaceInfo, IFacingInfo, UsesInit, UsesInit, UsesInit { [FieldLoader.LoadUsing("LoadSpeeds", true)] @@ -317,7 +317,7 @@ namespace OpenRA.Mods.Common.Traits bool IOccupySpaceInfo.SharesCell { get { return SharesCell; } } } - public class Mobile : UpgradableTrait, IIssueOrder, IResolveOrder, IOrderVoice, IPositionable, IMove, IFacing, ISync, + public class Mobile : ConditionalTrait, IIssueOrder, IResolveOrder, IOrderVoice, IPositionable, IMove, IFacing, ISync, IDeathActorInitModifier, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyBlockingMove, IActorPreviewInitModifier { const int AverageTicksBeforePathing = 5; diff --git a/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs b/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs index 8b891a834c..d5894a5f5f 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Display a colored overlay when a timed upgrade is active.")] - public class UpgradeOverlayInfo : UpgradableTraitInfo + public class UpgradeOverlayInfo : ConditionalTraitInfo { [Desc("Palette to use when rendering the overlay")] [PaletteReference] public readonly string Palette = "invuln"; @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new UpgradeOverlay(this); } } - public class UpgradeOverlay : UpgradableTrait, IRenderModifier + public class UpgradeOverlay : ConditionalTrait, IRenderModifier { public UpgradeOverlay(UpgradeOverlayInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Multipliers/DamageMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/DamageMultiplier.cs index 8d133ea0da..6f73553360 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/DamageMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/DamageMultiplier.cs @@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the damage applied to this actor.", "Use 0 to make actor invulnerable.")] - public class DamageMultiplierInfo : UpgradableTraitInfo + public class DamageMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new DamageMultiplier(this); } } - public class DamageMultiplier : UpgradableTrait, IDamageModifier + public class DamageMultiplier : ConditionalTrait, IDamageModifier { public DamageMultiplier(DamageMultiplierInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Multipliers/FirepowerMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/FirepowerMultiplier.cs index 8248089e0c..cbb6c6197f 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/FirepowerMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/FirepowerMultiplier.cs @@ -12,7 +12,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the damage applied by this actor.")] - public class FirepowerMultiplierInfo : UpgradableTraitInfo + public class FirepowerMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new FirepowerMultiplier(this); } } - public class FirepowerMultiplier : UpgradableTrait, IFirepowerModifier + public class FirepowerMultiplier : ConditionalTrait, IFirepowerModifier { public FirepowerMultiplier(FirepowerMultiplierInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Multipliers/InaccuracyMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/InaccuracyMultiplier.cs index c3dc05bd13..5a46817a02 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/InaccuracyMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/InaccuracyMultiplier.cs @@ -12,7 +12,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the inaccuracy of weapons fired by this actor.")] - public class InaccuracyMultiplierInfo : UpgradableTraitInfo + public class InaccuracyMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new InaccuracyMultiplier(this); } } - public class InaccuracyMultiplier : UpgradableTrait, IInaccuracyModifier + public class InaccuracyMultiplier : ConditionalTrait, IInaccuracyModifier { public InaccuracyMultiplier(InaccuracyMultiplierInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Multipliers/PowerMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/PowerMultiplier.cs index 68d493b6bb..d294c9e82e 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/PowerMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/PowerMultiplier.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the power usage/output of this actor.")] - public class PowerMultiplierInfo : UpgradableTraitInfo + public class PowerMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new PowerMultiplier(init.Self, this); } } - public class PowerMultiplier : UpgradableTrait, IPowerModifier, INotifyOwnerChanged + public class PowerMultiplier : ConditionalTrait, IPowerModifier, INotifyOwnerChanged { PowerManager power; diff --git a/OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs index 11979e3ad6..ab8c0514cd 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs @@ -12,7 +12,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the range of weapons fired by this actor.")] - public class RangeMultiplierInfo : UpgradableTraitInfo + public class RangeMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new RangeMultiplier(this); } } - public class RangeMultiplier : UpgradableTrait, IRangeModifierInfo + public class RangeMultiplier : ConditionalTrait, IRangeModifierInfo { public RangeMultiplier(RangeMultiplierInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Multipliers/ReloadDelayMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/ReloadDelayMultiplier.cs index 793367d7d3..f8509234fa 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/ReloadDelayMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/ReloadDelayMultiplier.cs @@ -12,7 +12,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the reload time of weapons fired by this actor.")] - public class ReloadDelayMultiplierInfo : UpgradableTraitInfo + public class ReloadDelayMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new ReloadDelayMultiplier(this); } } - public class ReloadDelayMultiplier : UpgradableTrait, IReloadModifier + public class ReloadDelayMultiplier : ConditionalTrait, IReloadModifier { public ReloadDelayMultiplier(ReloadDelayMultiplierInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Multipliers/SpeedMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/SpeedMultiplier.cs index 2b885d4b25..42673cd6d3 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/SpeedMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/SpeedMultiplier.cs @@ -12,7 +12,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Modifies the movement speed of this actor.")] - public class SpeedMultiplierInfo : UpgradableTraitInfo + public class SpeedMultiplierInfo : ConditionalTraitInfo { [FieldLoader.Require] [Desc("Percentage modifier to apply.")] @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new SpeedMultiplier(this); } } - public class SpeedMultiplier : UpgradableTrait, ISpeedModifier + public class SpeedMultiplier : ConditionalTrait, ISpeedModifier { public SpeedMultiplier(SpeedMultiplierInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs b/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs index 6b5953a3b8..4718531387 100644 --- a/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs +++ b/OpenRA.Mods.Common/Traits/Power/CanPowerDown.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("The player can disable the power individually on this actor.")] - public class CanPowerDownInfo : UpgradableTraitInfo, Requires + public class CanPowerDownInfo : ConditionalTraitInfo, Requires { [Desc("Restore power when this trait is disabled.")] public readonly bool CancelWhenDisabled = false; @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new CanPowerDown(init.Self, this); } } - public class CanPowerDown : UpgradableTrait, IPowerModifier, IResolveOrder, IDisable, INotifyOwnerChanged + public class CanPowerDown : ConditionalTrait, IPowerModifier, IResolveOrder, IDisable, INotifyOwnerChanged { [Sync] bool disabled = false; PowerManager power; diff --git a/OpenRA.Mods.Common/Traits/Power/Power.cs b/OpenRA.Mods.Common/Traits/Power/Power.cs index 148d614bc1..ce74d7669c 100644 --- a/OpenRA.Mods.Common/Traits/Power/Power.cs +++ b/OpenRA.Mods.Common/Traits/Power/Power.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public class PowerInfo : UpgradableTraitInfo + public class PowerInfo : ConditionalTraitInfo { [Desc("If negative, it will drain power. If positive, it will provide power.")] public readonly int Amount = 0; @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Power(init.Self, this); } } - public class Power : UpgradableTrait, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged + public class Power : ConditionalTrait, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged { readonly Lazy powerModifiers; diff --git a/OpenRA.Mods.Common/Traits/Power/RequiresPower.cs b/OpenRA.Mods.Common/Traits/Power/RequiresPower.cs index 9ce0217462..32e5003b36 100644 --- a/OpenRA.Mods.Common/Traits/Power/RequiresPower.cs +++ b/OpenRA.Mods.Common/Traits/Power/RequiresPower.cs @@ -14,12 +14,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Needs power to operate.")] - class RequiresPowerInfo : UpgradableTraitInfo, ITraitInfo + class RequiresPowerInfo : ConditionalTraitInfo, ITraitInfo { public override object Create(ActorInitializer init) { return new RequiresPower(init.Self, this); } } - class RequiresPower : UpgradableTrait, IDisable, INotifyOwnerChanged + class RequiresPower : ConditionalTrait, IDisable, INotifyOwnerChanged { PowerManager playerPower; diff --git a/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs b/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs index 42a0f62243..2343561899 100644 --- a/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs +++ b/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Derive facings from sprite body sequence.")] - public class QuantizeFacingsFromSequenceInfo : UpgradableTraitInfo, IQuantizeBodyOrientationInfo, Requires + public class QuantizeFacingsFromSequenceInfo : ConditionalTraitInfo, IQuantizeBodyOrientationInfo, Requires { [Desc("Defines sequence to derive facings from."), SequenceReference] public readonly string Sequence = "idle"; @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new QuantizeFacingsFromSequence(this); } } - public class QuantizeFacingsFromSequence : UpgradableTrait + public class QuantizeFacingsFromSequence : ConditionalTrait { public QuantizeFacingsFromSequence(QuantizeFacingsFromSequenceInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/RejectsOrders.cs b/OpenRA.Mods.Common/Traits/RejectsOrders.cs index 5ced75b6cd..ac48f4e564 100644 --- a/OpenRA.Mods.Common/Traits/RejectsOrders.cs +++ b/OpenRA.Mods.Common/Traits/RejectsOrders.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Can be used to make a unit partly uncontrollable by the player.")] - public class RejectsOrdersInfo : UpgradableTraitInfo + public class RejectsOrdersInfo : ConditionalTraitInfo { [Desc("Possible values include Attack, AttackMove, Guard, Move.")] public readonly HashSet Except = new HashSet(); @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new RejectsOrders(this); } } - public class RejectsOrders : UpgradableTrait + public class RejectsOrders : ConditionalTrait { public HashSet Except { get { return Info.Except; } } diff --git a/OpenRA.Mods.Common/Traits/Render/Hovers.cs b/OpenRA.Mods.Common/Traits/Render/Hovers.cs index 2a01ad9fe6..1e44751a71 100644 --- a/OpenRA.Mods.Common/Traits/Render/Hovers.cs +++ b/OpenRA.Mods.Common/Traits/Render/Hovers.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Changes the visual Z position periodically.")] - public class HoversInfo : UpgradableTraitInfo, Requires + public class HoversInfo : ConditionalTraitInfo, Requires { [Desc("Amount of Z axis changes in world units.")] public readonly int OffsetModifier = -43; @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new Hovers(this, init.Self); } } - public class Hovers : UpgradableTrait, IRenderModifier + public class Hovers : ConditionalTrait, IRenderModifier { readonly HoversInfo info; diff --git a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs index 8fc813c2de..f40dcc42f1 100644 --- a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs +++ b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits.Render public enum TrailType { Cell, CenterPosition } [Desc("Renders a sprite effect when leaving a cell.")] - public class LeavesTrailsInfo : UpgradableTraitInfo + public class LeavesTrailsInfo : ConditionalTraitInfo { public readonly string Image = null; @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new LeavesTrails(init.Self, this); } } - public class LeavesTrails : UpgradableTrait, ITick + public class LeavesTrails : ConditionalTrait, ITick { BodyOrientation body; IFacing facing; diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs index c391c46f5d..68a493ec38 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits.Render } [Desc("Displays a custom UI overlay relative to the selection box.")] - public class WithDecorationInfo : UpgradableTraitInfo + public class WithDecorationInfo : ConditionalTraitInfo { [Desc("Image used for this decoration. Defaults to the actor's type.")] public readonly string Image = null; @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new WithDecoration(init.Self, this); } } - public class WithDecoration : UpgradableTrait, ITick, IRenderAboveShroud, IRenderAboveShroudWhenSelected + public class WithDecoration : ConditionalTrait, ITick, IRenderAboveShroud, IRenderAboveShroudWhenSelected { protected readonly Animation Anim; diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs index 9236dabb4c..32286a8f57 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleAnimation.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Periodically plays an idle animation, replacing the default body animation.")] - public class WithIdleAnimationInfo : UpgradableTraitInfo, Requires + public class WithIdleAnimationInfo : ConditionalTraitInfo, Requires { [SequenceReference, Desc("Sequence names to use.")] public readonly string[] Sequences = { "active" }; @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new WithIdleAnimation(init.Self, this); } } - public class WithIdleAnimation : UpgradableTrait, ITick, INotifyBuildComplete, INotifySold + public class WithIdleAnimation : ConditionalTrait, ITick, INotifyBuildComplete, INotifySold { readonly WithSpriteBody wsb; bool buildComplete; diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs index ec779e2cc7..1ddd47c394 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders a decorative animation on units and buildings.")] - public class WithIdleOverlayInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires + public class WithIdleOverlayInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires { [Desc("Animation to play when the actor is created.")] [SequenceReference] public readonly string StartSequence = null; @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithIdleOverlay : UpgradableTrait, INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyTransform + public class WithIdleOverlay : ConditionalTrait, INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyTransform { readonly Animation overlay; bool buildComplete; diff --git a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs index ad1eaa0195..55d6cd3dea 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { - public class WithInfantryBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires + public class WithInfantryBodyInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires { public readonly int MinIdleDelay = 30; public readonly int MaxIdleDelay = 110; @@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithInfantryBody : UpgradableTrait, ITick, INotifyAttack, INotifyIdle + public class WithInfantryBody : ConditionalTrait, ITick, INotifyAttack, INotifyIdle { readonly IMove move; protected readonly Animation DefaultAnimation; diff --git a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs index e5044a556b..bb0695d786 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders the MuzzleSequence from the Armament trait.")] - class WithMuzzleOverlayInfo : UpgradableTraitInfo, Requires, Requires, Requires + class WithMuzzleOverlayInfo : ConditionalTraitInfo, Requires, Requires, Requires { [Desc("Ignore the weapon position, and always draw relative to the center of the actor")] public readonly bool IgnoreOffset = false; @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new WithMuzzleOverlay(init.Self, this); } } - class WithMuzzleOverlay : UpgradableTrait, INotifyAttack, IRender, ITick + class WithMuzzleOverlay : ConditionalTrait, INotifyAttack, IRender, ITick { readonly Dictionary visible = new Dictionary(); readonly Dictionary anims = new Dictionary(); diff --git a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs index aa3692950b..c718369488 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs @@ -19,7 +19,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders a parachute on units.")] - public class WithParachuteInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires + public class WithParachuteInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires { [Desc("The image that contains the parachute sequences.")] public readonly string Image = null; @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithParachute : UpgradableTrait, ITick, IRender + public class WithParachute : ConditionalTrait, ITick, IRender { readonly Animation shadow; readonly AnimationWithOffset anim; diff --git a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs index 1cd25cdd60..a64e3ead98 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Clones the actor sprite with another palette below it.")] - public class WithShadowInfo : UpgradableTraitInfo + public class WithShadowInfo : ConditionalTraitInfo { [PaletteReference] public readonly string Palette = "shadow"; @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new WithShadow(this); } } - public class WithShadow : UpgradableTrait, IRenderModifier + public class WithShadow : ConditionalTrait, IRenderModifier { readonly WithShadowInfo info; diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBarrel.cs index 894ed089c7..93146c75b5 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBarrel.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBarrel.cs @@ -19,7 +19,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders barrels for units with the Turreted trait.")] - public class WithSpriteBarrelInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires, + public class WithSpriteBarrelInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires, Requires, Requires { [Desc("Sequence name to use.")] @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithSpriteBarrel : UpgradableTrait + public class WithSpriteBarrel : ConditionalTrait { public readonly Animation DefaultAnimation; readonly RenderSprites rs; diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index c4a4eb1561..b5b141c340 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Default trait for rendering sprite-based actors.")] - public class WithSpriteBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires + public class WithSpriteBodyInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires { [Desc("Animation to play when the actor is created."), SequenceReference] public readonly string StartSequence = null; @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithSpriteBody : UpgradableTrait, INotifyDamageStateChanged, INotifyBuildComplete + public class WithSpriteBody : ConditionalTrait, INotifyDamageStateChanged, INotifyBuildComplete { public readonly Animation DefaultAnimation; diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteTurret.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteTurret.cs index 9bc4e41e79..62560e2074 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteTurret.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteTurret.cs @@ -19,7 +19,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders turrets for units with the Turreted trait.")] - public class WithSpriteTurretInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, + public class WithSpriteTurretInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires, Requires, Requires { [Desc("Sequence name to use")] @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithSpriteTurret : UpgradableTrait, INotifyBuildComplete, INotifySold, INotifyTransform, ITick, INotifyDamageStateChanged + public class WithSpriteTurret : ConditionalTrait, INotifyBuildComplete, INotifySold, INotifyTransform, ITick, INotifyDamageStateChanged { public readonly Animation DefaultAnimation; protected readonly AttackBase Attack; diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs index d78a144fd7..812eafcb41 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs @@ -20,7 +20,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Displays a text overlay relative to the selection box.")] - public class WithTextDecorationInfo : UpgradableTraitInfo + public class WithTextDecorationInfo : ConditionalTraitInfo { [FieldLoader.Require] [Translate] public readonly string Text = null; @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithTextDecoration : UpgradableTrait, IRender, IRenderAboveShroudWhenSelected, INotifyCapture + public class WithTextDecoration : ConditionalTrait, IRender, IRenderAboveShroudWhenSelected, INotifyCapture { readonly SpriteFont font; Color color; diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs index d531e6fa99..c2952e41e8 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { - public class WithVoxelBarrelInfo : UpgradableTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires + public class WithVoxelBarrelInfo : ConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires { [Desc("Voxel sequence name to use")] public readonly string Sequence = "barrel"; @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithVoxelBarrel : UpgradableTrait, INotifyBuildComplete, INotifySold, INotifyTransform + public class WithVoxelBarrel : ConditionalTrait, INotifyBuildComplete, INotifySold, INotifyTransform { readonly Actor self; readonly Armament armament; diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs index 27ef51adb4..b4d73bf3d6 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs @@ -19,7 +19,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Also returns a default selection size that is calculated automatically from the voxel dimensions.")] - public class WithVoxelBodyInfo : UpgradableTraitInfo, IRenderActorPreviewVoxelsInfo, Requires + public class WithVoxelBodyInfo : ConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires { public readonly string Sequence = "idle"; @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithVoxelBody : UpgradableTrait, IAutoSelectionSize + public class WithVoxelBody : ConditionalTrait, IAutoSelectionSize { readonly int2 size; diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs index 421e833665..08ee249a76 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { - public class WithVoxelTurretInfo : UpgradableTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires + public class WithVoxelTurretInfo : ConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires { [Desc("Voxel sequence name to use")] public readonly string Sequence = "turret"; @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithVoxelTurret : UpgradableTrait, INotifyBuildComplete, INotifySold, INotifyTransform + public class WithVoxelTurret : ConditionalTrait, INotifyBuildComplete, INotifySold, INotifyTransform { readonly Actor self; readonly Turreted turreted; diff --git a/OpenRA.Mods.Common/Traits/SeedsResource.cs b/OpenRA.Mods.Common/Traits/SeedsResource.cs index 33242b12dd..2b43a969ae 100644 --- a/OpenRA.Mods.Common/Traits/SeedsResource.cs +++ b/OpenRA.Mods.Common/Traits/SeedsResource.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Lets the actor spread resources around it in a circle.")] - class SeedsResourceInfo : UpgradableTraitInfo + class SeedsResourceInfo : ConditionalTraitInfo { public readonly int Interval = 75; public readonly string ResourceType = "Ore"; @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new SeedsResource(init.Self, this); } } - class SeedsResource : UpgradableTrait, ITick, ISeedableResource + class SeedsResource : ConditionalTrait, ITick, ISeedableResource { readonly SeedsResourceInfo info; diff --git a/OpenRA.Mods.Common/Traits/SelfHealing.cs b/OpenRA.Mods.Common/Traits/SelfHealing.cs index 745455ed2f..1cc7d85964 100644 --- a/OpenRA.Mods.Common/Traits/SelfHealing.cs +++ b/OpenRA.Mods.Common/Traits/SelfHealing.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Attach this to actors which should be able to regenerate their health points.")] - class SelfHealingInfo : UpgradableTraitInfo, Requires + class SelfHealingInfo : ConditionalTraitInfo, Requires { [Desc("Absolute amount of health points added in each step.")] public readonly int Step = 5; @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); } } - class SelfHealing : UpgradableTrait, ITick, INotifyDamage + class SelfHealing : ConditionalTrait, ITick, INotifyDamage { readonly Health health; diff --git a/OpenRA.Mods.Common/Traits/Sellable.cs b/OpenRA.Mods.Common/Traits/Sellable.cs index a50cc69c66..e56fc67842 100644 --- a/OpenRA.Mods.Common/Traits/Sellable.cs +++ b/OpenRA.Mods.Common/Traits/Sellable.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Actor can be sold")] - public class SellableInfo : UpgradableTraitInfo + public class SellableInfo : ConditionalTraitInfo { public readonly int RefundPercent = 50; public readonly string[] SellSounds = { }; @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Sellable(init.Self, this); } } - public class Sellable : UpgradableTrait, IResolveOrder, IProvideTooltipInfo + public class Sellable : ConditionalTrait, IResolveOrder, IProvideTooltipInfo { readonly Actor self; readonly Lazy health; diff --git a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs index 1aba3c51db..619420f7f0 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Sound { [Desc("Plays a looping audio file at the actor position. Attach this to the `World` actor to cover the whole map.")] - class AmbientSoundInfo : UpgradableTraitInfo + class AmbientSoundInfo : ConditionalTraitInfo { [FieldLoader.Require] public readonly string SoundFile = null; @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits.Sound public override object Create(ActorInitializer init) { return new AmbientSound(init.Self, this); } } - class AmbientSound : UpgradableTrait, ITick + class AmbientSound : ConditionalTrait, ITick { ISound currentSound; bool wasDisabled = true; diff --git a/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs b/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs index bf6fede1de..3b28dfe66a 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Sound { [Desc("Played when preparing for an attack or attacking.")] - public class AttackSoundsInfo : UpgradableTraitInfo + public class AttackSoundsInfo : ConditionalTraitInfo { [Desc("Play a randomly selected sound from this list when preparing for an attack or attacking.")] public readonly string[] Sounds = { }; @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits.Sound public override object Create(ActorInitializer init) { return new AttackSounds(init, this); } } - public class AttackSounds : UpgradableTrait, INotifyAttack, ITick + public class AttackSounds : ConditionalTrait, INotifyAttack, ITick { readonly AttackSoundsInfo info; int tick; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 130a07aa9a..6432579b9c 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public abstract class SupportPowerInfo : UpgradableTraitInfo + public abstract class SupportPowerInfo : ConditionalTraitInfo { [Desc("Measured in seconds.")] public readonly int ChargeTime = 0; @@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits public SupportPowerInfo() { OrderName = GetType().Name + "Order"; } } - public class SupportPower : UpgradableTrait + public class SupportPower : ConditionalTrait { public readonly Actor Self; readonly SupportPowerInfo info; diff --git a/OpenRA.Mods.Common/Traits/Targetable.cs b/OpenRA.Mods.Common/Traits/Targetable.cs index 11a32908ee..598eb1d152 100644 --- a/OpenRA.Mods.Common/Traits/Targetable.cs +++ b/OpenRA.Mods.Common/Traits/Targetable.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Actor can be targeted.")] - public class TargetableInfo : UpgradableTraitInfo, ITargetableInfo + public class TargetableInfo : ConditionalTraitInfo, ITargetableInfo { [Desc("Target type. Used for filtering (in)valid targets.")] public readonly HashSet TargetTypes = new HashSet(); @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Targetable(init.Self, this); } } - public class Targetable : UpgradableTrait, ITargetable + public class Targetable : ConditionalTrait, ITargetable { protected static readonly string[] None = new string[] { }; protected Cloak[] cloaks; diff --git a/OpenRA.Mods.Common/Traits/Tooltip.cs b/OpenRA.Mods.Common/Traits/Tooltip.cs index 33dcc8505e..61340972fa 100644 --- a/OpenRA.Mods.Common/Traits/Tooltip.cs +++ b/OpenRA.Mods.Common/Traits/Tooltip.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public abstract class TooltipInfoBase : UpgradableTraitInfo + public abstract class TooltipInfoBase : ConditionalTraitInfo { [Translate] public readonly string Name = ""; } @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits public bool IsOwnerRowVisible { get { return ShowOwnerRow; } } } - public class Tooltip : UpgradableTrait, ITooltip + public class Tooltip : ConditionalTrait, ITooltip { readonly Actor self; readonly TooltipInfo info; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs b/OpenRA.Mods.Common/Traits/Upgrades/ConditionalTrait.cs similarity index 91% rename from OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs rename to OpenRA.Mods.Common/Traits/Upgrades/ConditionalTrait.cs index 0033635bbb..9818eed104 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ConditionalTrait.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { /// Use as base class for *Info to subclass of UpgradableTrait. (See UpgradableTrait.) - public abstract class UpgradableTraitInfo : IConditionConsumerInfo, IRulesetLoaded + public abstract class ConditionalTraitInfo : IConditionConsumerInfo, IRulesetLoaded { static readonly IReadOnlyDictionary NoConditions = new ReadOnlyDictionary(new Dictionary()); @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits /// Requires basing *Info on UpgradableTraitInfo and using base(info) constructor. /// TraitEnabled will be called at creation if the trait starts enabled or does not use conditions. /// - public abstract class UpgradableTrait : IConditionConsumer, IDisabledTrait, INotifyCreated, ISync where InfoType : UpgradableTraitInfo + public abstract class ConditionalTrait : IConditionConsumer, IDisabledTrait, INotifyCreated, ISync where InfoType : ConditionalTraitInfo { public readonly InfoType Info; @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits [Sync] public bool IsTraitDisabled { get; private set; } - public UpgradableTrait(InfoType info) + public ConditionalTrait(InfoType info) { Info = info; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs index e310d83b89..62280cfe60 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs @@ -14,12 +14,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Disable the actor when this trait is enabled by a condition.")] - public class DisableOnConditionInfo : UpgradableTraitInfo + public class DisableOnConditionInfo : ConditionalTraitInfo { public override object Create(ActorInitializer init) { return new DisableOnCondition(this); } } - public class DisableOnCondition : UpgradableTrait, IDisable + public class DisableOnCondition : ConditionalTrait, IDisable { public DisableOnCondition(DisableOnConditionInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs index 1b122de42c..8d06019820 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Grants a condition while the trait is active.")] - class GrantConditionInfo : UpgradableTraitInfo + class GrantConditionInfo : ConditionalTraitInfo { [FieldLoader.Require] [GrantedConditionReference] @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new GrantCondition(this); } } - class GrantCondition : UpgradableTrait + class GrantCondition : ConditionalTrait { ConditionManager conditionManager; int conditionToken = ConditionManager.InvalidConditionToken; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs index e99784af06..eb268446de 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public class GrantConditionOnMovementInfo : UpgradableTraitInfo, Requires + public class GrantConditionOnMovementInfo : ConditionalTraitInfo, Requires { [FieldLoader.Require] [GrantedConditionReference] @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new GrantConditionOnMovement(init.Self, this); } } - public class GrantConditionOnMovement : UpgradableTrait, ITick + public class GrantConditionOnMovement : ConditionalTrait, ITick { readonly IMove movement; diff --git a/OpenRA.Mods.Common/Traits/Wanders.cs b/OpenRA.Mods.Common/Traits/Wanders.cs index 3c0f5983d5..3e648c0389 100644 --- a/OpenRA.Mods.Common/Traits/Wanders.cs +++ b/OpenRA.Mods.Common/Traits/Wanders.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Wanders around aimlessly while idle.")] - public class WandersInfo : UpgradableTraitInfo, Requires + public class WandersInfo : ConditionalTraitInfo, Requires { public readonly int WanderMoveRadius = 1; @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Wanders(init.Self, this); } } - public class Wanders : UpgradableTrait, INotifyIdle, INotifyBecomingIdle + public class Wanders : ConditionalTrait, INotifyIdle, INotifyBecomingIdle { readonly Actor self; readonly WandersInfo info; diff --git a/OpenRA.Mods.D2k/Traits/AttractsWorms.cs b/OpenRA.Mods.D2k/Traits/AttractsWorms.cs index 455499454b..1d0f3619dd 100644 --- a/OpenRA.Mods.D2k/Traits/AttractsWorms.cs +++ b/OpenRA.Mods.D2k/Traits/AttractsWorms.cs @@ -14,7 +14,7 @@ using OpenRA.Mods.Common.Traits; namespace OpenRA.Mods.D2k.Traits { [Desc("This actor makes noise, which causes them to be targeted by actors with the Sandworm trait.")] - public class AttractsWormsInfo : UpgradableTraitInfo + public class AttractsWormsInfo : ConditionalTraitInfo { [Desc("How much noise this actor produces.")] public readonly int Intensity = 0; @@ -31,7 +31,7 @@ namespace OpenRA.Mods.D2k.Traits public override object Create(ActorInitializer init) { return new AttractsWorms(init, this); } } - public class AttractsWorms : UpgradableTrait + public class AttractsWorms : ConditionalTrait { readonly Actor self; From 2322d40395821d66aff26e7cbfbc054912d6a9cb Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 23:29:40 +0000 Subject: [PATCH 11/11] Renamed Upgrades directory to Conditions. --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 22 +++++++++---------- .../ConditionManager.cs | 0 .../ConditionalTrait.cs | 0 .../DisableOnCondition.cs | 0 .../ExternalConditions.cs | 0 .../GrantCondition.cs | 0 .../GrantConditionOnDamageState.cs | 0 .../GrantConditionOnDeploy.cs | 0 .../GrantConditionOnMovement.cs | 0 .../GrantConditionOnTerrain.cs | 0 .../ProximityExternalCondition.cs | 0 .../StackedCondition.cs | 0 12 files changed, 11 insertions(+), 11 deletions(-) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/ConditionManager.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/ConditionalTrait.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/DisableOnCondition.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/ExternalConditions.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/GrantCondition.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/GrantConditionOnDamageState.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/GrantConditionOnDeploy.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/GrantConditionOnMovement.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/GrantConditionOnTerrain.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/ProximityExternalCondition.cs (100%) rename OpenRA.Mods.Common/Traits/{Upgrades => Conditions}/StackedCondition.cs (100%) diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index ab3f66453e..93aaa12c61 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -491,14 +491,14 @@ - - - - - - - - + + + + + + + + @@ -772,9 +772,9 @@ - - - + + + diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs b/OpenRA.Mods.Common/Traits/Conditions/ConditionManager.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs rename to OpenRA.Mods.Common/Traits/Conditions/ConditionManager.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ConditionalTrait.cs b/OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/ConditionalTrait.cs rename to OpenRA.Mods.Common/Traits/Conditions/ConditionalTrait.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/DisableOnCondition.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/DisableOnCondition.cs rename to OpenRA.Mods.Common/Traits/Conditions/DisableOnCondition.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs b/OpenRA.Mods.Common/Traits/Conditions/ExternalConditions.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs rename to OpenRA.Mods.Common/Traits/Conditions/ExternalConditions.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantCondition.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs rename to OpenRA.Mods.Common/Traits/Conditions/GrantCondition.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDamageState.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs rename to OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDamageState.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs rename to OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnMovement.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs rename to OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnMovement.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnTerrain.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs rename to OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnTerrain.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs rename to OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs diff --git a/OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/StackedCondition.cs similarity index 100% rename from OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs rename to OpenRA.Mods.Common/Traits/Conditions/StackedCondition.cs