diff --git a/OpenRA.Game/Traits/LintAttributes.cs b/OpenRA.Game/Traits/LintAttributes.cs index e32f227c56..c1dbde1aef 100644 --- a/OpenRA.Game/Traits/LintAttributes.cs +++ b/OpenRA.Game/Traits/LintAttributes.cs @@ -46,11 +46,11 @@ namespace OpenRA.Traits } } - [AttributeUsage(AttributeTargets.Field)] - public sealed class UpgradeGrantedReferenceAttribute : Attribute { } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class GrantedConditionReferenceAttribute : Attribute { } - [AttributeUsage(AttributeTargets.Field)] - public sealed class UpgradeUsedReferenceAttribute : Attribute { } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class ConsumedConditionReferenceAttribute : Attribute { } [AttributeUsage(AttributeTargets.Field)] public sealed class PaletteDefinitionAttribute : Attribute diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 47c911cb4f..be07531a5e 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -52,11 +52,11 @@ namespace OpenRA.Mods.Common.Traits [VoiceReference] public readonly string Voice = "Action"; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while airborne.")] public readonly string AirborneCondition = null; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while at cruise altitude.")] public readonly string CruisingCondition = null; diff --git a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs index 25fda44e21..12e417367a 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Used together with ClassicProductionQueue.")] public class PrimaryBuildingInfo : ITraitInfo { - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while this is the primary building.")] public readonly string PrimaryCondition = null; diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 83105f4be7..f31f1070b7 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -55,20 +55,22 @@ namespace OpenRA.Mods.Common.Traits [Desc("Cursor to display when unable to unload the passengers.")] public readonly string UnloadBlockedCursor = "deploy-blocked"; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while waiting for cargo to load.")] public readonly string LoadingCondition = null; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while passengers are loaded.", "Condition can stack with multiple passengers.")] public readonly string LoadedCondition = null; - [UpgradeGrantedReference] [Desc("Conditions to grant when specified actors are loaded inside the transport.", "A dictionary of [actor id]: [condition].")] public readonly Dictionary PassengerConditions = new Dictionary(); + [GrantedConditionReference] + public IEnumerable LinterPassengerConditions { get { return PassengerConditions.Values; } } + public object Create(ActorInitializer init) { return new Cargo(init, this); } } diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index c2a1c3e8b9..bc78ba666a 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -17,11 +17,11 @@ namespace OpenRA.Mods.Common.Traits [Desc("Can be carried by actors with the `Carryall` trait.")] public class CarryableInfo : UpgradableTraitInfo { - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while a carryall has been reserved.")] public readonly string ReservedCondition = null; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while being carried.")] public readonly string CarriedCondition = null; diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 3e5706a8b8..2de32c0b91 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits public readonly HashSet CloakTypes = new HashSet { "Cloak" }; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while cloaked.")] public readonly string CloakedCondition = null; diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index c0deb86f02..bd08e47810 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -27,6 +27,9 @@ namespace OpenRA.Mods.Common.Traits "Value is a list of the upgrade types to grant")] public readonly Dictionary Conditions = null; + [GrantedConditionReference] + public IEnumerable LinterConditions { get { return Conditions.Values; } } + [Desc("Palette for the level up sprite.")] [PaletteReference] public readonly string LevelUpPalette = "effect"; diff --git a/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs b/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs index 77b01d7f7c..bd3ce0eb6f 100644 --- a/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class GrantConditionOnPrerequisiteInfo : ITraitInfo { [FieldLoader.Require] - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant.")] public readonly string Condition = null; diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 7301c197ef..4aa4413f2f 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int FallRate = 13; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while parachuting.")] public readonly string ParachutingCondition = null; diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index d1214be5b6..797558075a 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -20,10 +20,12 @@ namespace OpenRA.Mods.Common.Traits public readonly CVec Offset = CVec.Zero; [FieldLoader.Require] - [UpgradeGrantedReference] [Desc("Conditions to grant for each accepted plug type.")] public readonly Dictionary Conditions = null; + [GrantedConditionReference] + public IEnumerable LinterConditions { get { return Conditions.Values; } } + public object Create(ActorInitializer init) { return new Pluggable(init, this); } } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs b/OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs index c544a6c188..6ed1a15013 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits "Externally granted conditions that aren't explicitly whitelisted will be silently ignored.")] public class ExternalConditionsInfo : TraitInfo { - [UpgradeGrantedReference] + [GrantedConditionReference] public readonly string[] Conditions = { }; } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs index 94e89d06ec..e212c1691b 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits class GrantConditionInfo : UpgradableTraitInfo { [FieldLoader.Require] - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("Condition to grant.")] public readonly string Condition = null; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs index 630d5d372d..a35e2fb404 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits public class GrantConditionOnDamageStateInfo : ITraitInfo, Requires { [FieldLoader.Require] - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("Condition to grant.")] public readonly string Condition = null; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs index 3272deeb24..51d69c7cc3 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs @@ -21,11 +21,12 @@ namespace OpenRA.Mods.Common.Traits { public class GrantConditionOnDeployInfo : ITraitInfo { - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant while the actor is undeployed.")] public readonly string UndeployedCondition = null; - [UpgradeGrantedReference, FieldLoader.Require] + [FieldLoader.Require] + [GrantedConditionReference] [Desc("The condition to grant after deploying and revoke before undeploying.")] public readonly string DeployedCondition = null; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs index b9137d48c1..17b12fd025 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnMovement.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits public class GrantConditionOnMovementInfo : UpgradableTraitInfo, Requires { [FieldLoader.Require] - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("Condition to grant.")] public readonly string Condition = null; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs index d00d8a581f..58f7a85404 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnTerrain.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits public class GrantConditionOnTerrainInfo : ITraitInfo { [FieldLoader.Require] - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("Condition to grant.")] public readonly string Condition = null; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs index 3d0e6d2c69..750d45775f 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs @@ -17,12 +17,12 @@ namespace OpenRA.Mods.Common.Traits public class StackedConditionInfo : TraitInfo { [FieldLoader.Require] - [UpgradeUsedReference] + [ConsumedConditionReference] [Desc("Condition to monitor.")] public readonly string Condition = null; [FieldLoader.Require] - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("Conditions to grant when the monitored condition is granted multiple times.", "The first entry is activated at 2x grants, second entry at 3x grants, and so on.")] public readonly string[] StackedConditions = { }; diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs b/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs index 527679875f..b4ca31189b 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits { static readonly IReadOnlyDictionary NoConditions = new ReadOnlyDictionary(new Dictionary()); - [UpgradeUsedReference] + [ConsumedConditionReference] [Desc("Boolean expression defining the condition to enable this trait.")] public readonly BooleanExpression RequiresCondition = null; diff --git a/OpenRA.Mods.D2k/Traits/AttackSwallow.cs b/OpenRA.Mods.D2k/Traits/AttackSwallow.cs index 19b8fc53f7..eee37f2cc0 100644 --- a/OpenRA.Mods.D2k/Traits/AttackSwallow.cs +++ b/OpenRA.Mods.D2k/Traits/AttackSwallow.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.D2k.Traits [Desc("The number of ticks it takes to get in place under the target to attack.")] public readonly int AttackDelay = 30; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while attacking.")] public readonly string AttackingCondition = null; diff --git a/OpenRA.Mods.RA/Traits/Disguise.cs b/OpenRA.Mods.RA/Traits/Disguise.cs index 2416bb55ee..9f3980e9ae 100644 --- a/OpenRA.Mods.RA/Traits/Disguise.cs +++ b/OpenRA.Mods.RA/Traits/Disguise.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA.Traits { [VoiceReference] public readonly string Voice = "Action"; - [UpgradeGrantedReference] + [GrantedConditionReference] [Desc("The condition to grant to self while disguised.")] public readonly string DisguisedCondition = null;