From 024cc3db7e2b363b39dc9f935ee835fe69c04a1e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 13:25:28 +0000 Subject: [PATCH 01/14] Prepare condition attributes for new lint rule. --- OpenRA.Game/Traits/LintAttributes.cs | 8 ++++---- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 4 ++-- OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs | 2 +- OpenRA.Mods.Common/Traits/Cargo.cs | 8 +++++--- OpenRA.Mods.Common/Traits/Carryable.cs | 4 ++-- OpenRA.Mods.Common/Traits/Cloak.cs | 2 +- OpenRA.Mods.Common/Traits/GainsExperience.cs | 3 +++ OpenRA.Mods.Common/Traits/GrantConditionOnPrerequisite.cs | 2 +- OpenRA.Mods.Common/Traits/Parachutable.cs | 2 +- OpenRA.Mods.Common/Traits/Pluggable.cs | 4 +++- OpenRA.Mods.Common/Traits/Upgrades/ExternalConditions.cs | 2 +- OpenRA.Mods.Common/Traits/Upgrades/GrantCondition.cs | 2 +- .../Traits/Upgrades/GrantConditionOnDamageState.cs | 2 +- .../Traits/Upgrades/GrantConditionOnDeploy.cs | 5 +++-- .../Traits/Upgrades/GrantConditionOnMovement.cs | 2 +- .../Traits/Upgrades/GrantConditionOnTerrain.cs | 2 +- OpenRA.Mods.Common/Traits/Upgrades/StackedCondition.cs | 4 ++-- OpenRA.Mods.Common/Traits/Upgrades/UpgradableTrait.cs | 2 +- OpenRA.Mods.D2k/Traits/AttackSwallow.cs | 2 +- OpenRA.Mods.RA/Traits/Disguise.cs | 2 +- 20 files changed, 36 insertions(+), 28 deletions(-) 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; From 59013a581c3c734ebd9459d6271bbbb2b8e35e2d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 19:33:59 +0000 Subject: [PATCH 02/14] Remove unused airborne condition from TD aircraft. --- mods/cnc/rules/aircraft.yaml | 2 -- mods/cnc/rules/defaults.yaml | 1 - 2 files changed, 3 deletions(-) diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 9513645366..2e0f4d6c6c 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -167,7 +167,6 @@ C17: TurnSpeed: 5 Speed: 326 Repulsable: False - AirborneCondition: airborne MaximumPitch: 36 Health: HP: 25 @@ -206,7 +205,6 @@ A10: TurnSpeed: 4 Speed: 373 Repulsable: False - AirborneCondition: airborne Health: HP: 150 Armor: diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index bd13ca3576..4bf998bc95 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -839,7 +839,6 @@ Offset: 43, 128, 0 ZOffset: -129 Aircraft: - AirborneCondition: airborne CanHover: True FallsToEarth: Spins: True From a4227757b6c6de189f3f9830063b5c1973039f87 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 19:49:38 +0000 Subject: [PATCH 03/14] Move ^GainsExperience inherit to the actors. --- mods/cnc/rules/aircraft.yaml | 2 ++ mods/cnc/rules/defaults.yaml | 4 ---- mods/cnc/rules/infantry.yaml | 7 ++++++- mods/cnc/rules/ships.yaml | 1 + mods/cnc/rules/vehicles.yaml | 14 ++++++++++++-- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 2e0f4d6c6c..e19d1da4b5 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -53,6 +53,7 @@ TRAN: HELI: Inherits: ^Helicopter + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1200 Tooltip: @@ -111,6 +112,7 @@ HELI: ORCA: Inherits: ^Helicopter + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1200 Tooltip: diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 4bf998bc95..504b8dd02e 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -118,7 +118,6 @@ ^Vehicle: Inherits@1: ^ExistsInWorld - Inherits@2: ^GainsExperience Inherits@3: ^SpriteActor Huntable: Mobile: @@ -184,7 +183,6 @@ ^Helicopter: Inherits@1: ^ExistsInWorld - Inherits@2: ^GainsExperience Inherits@3: ^SpriteActor Huntable: AppearsOnRadar: @@ -231,7 +229,6 @@ ^Infantry: Inherits@1: ^ExistsInWorld - Inherits@2: ^GainsExperience Inherits@3: ^SpriteActor Huntable: Health: @@ -517,7 +514,6 @@ ^Ship: Inherits@1: ^ExistsInWorld - Inherits@2: ^GainsExperience Inherits@3: ^SpriteActor Huntable: Mobile: diff --git a/mods/cnc/rules/infantry.yaml b/mods/cnc/rules/infantry.yaml index 152d32b1a9..ffb3bc13bb 100644 --- a/mods/cnc/rules/infantry.yaml +++ b/mods/cnc/rules/infantry.yaml @@ -1,5 +1,6 @@ E1: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 100 Tooltip: @@ -21,6 +22,7 @@ E1: E2: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 160 Tooltip: @@ -48,6 +50,7 @@ E2: E3: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 300 Tooltip: @@ -72,6 +75,7 @@ E3: E4: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 200 Tooltip: @@ -97,6 +101,7 @@ E4: E5: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 300 Tooltip: @@ -148,10 +153,10 @@ E6: CaptureTypes: building, husk PlayerExperience: 50 -AutoTarget: - -GainsExperience: RMBO: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1000 Tooltip: diff --git a/mods/cnc/rules/ships.yaml b/mods/cnc/rules/ships.yaml index 22adf1106e..23e46248e8 100644 --- a/mods/cnc/rules/ships.yaml +++ b/mods/cnc/rules/ships.yaml @@ -1,5 +1,6 @@ BOAT: Inherits: ^Ship + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 300 Tooltip: diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index 2b1993933d..d2bde44795 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -31,7 +31,6 @@ MCV: BaseBuilding: SpawnActorOnDeath: Actor: MCV.Husk - -GainsExperience: -Cloak: SelectionDecorations: VisualBounds: 36,36 @@ -68,7 +67,6 @@ HARV: Range: 4c0 SpawnActorOnDeath: Actor: HARV.Husk - -GainsExperience: WithHarvestAnimation: WithDockingAnimation: Explodes: @@ -78,6 +76,7 @@ HARV: APC: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -126,6 +125,7 @@ APC: ARTY: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -161,6 +161,7 @@ ARTY: FTNK: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -194,6 +195,7 @@ FTNK: BGGY: Inherits: ^Vehicle + Inherits@@EXPERIENCE: ^GainsExperience Valued: Cost: 300 Tooltip: @@ -228,6 +230,7 @@ BGGY: BIKE: Inherits: ^Vehicle + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 500 Tooltip: @@ -264,6 +267,7 @@ BIKE: JEEP: Inherits: ^Vehicle + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 400 Tooltip: @@ -298,6 +302,7 @@ JEEP: LTNK: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 700 Tooltip: @@ -333,6 +338,7 @@ LTNK: MTNK: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 800 Tooltip: @@ -369,6 +375,7 @@ MTNK: HTNK: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1500 Tooltip: @@ -418,6 +425,7 @@ HTNK: MSAM: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1000 Tooltip: @@ -454,6 +462,7 @@ MSAM: MLRS: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -496,6 +505,7 @@ MLRS: STNK: Inherits: ^Vehicle + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 900 Tooltip: From b5390cb23cb4c8e9fe82160bc2cdff6e0c240021 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 19:53:47 +0000 Subject: [PATCH 04/14] Split out ^AcceptsCloakCrate template. --- mods/cnc/rules/defaults.yaml | 18 ++++++++++-------- mods/cnc/rules/vehicles.yaml | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 504b8dd02e..c0be31ff26 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -116,6 +116,16 @@ RequiresCondition: rank-elite ZOffset: 256 +^AcceptsCloakCrate: + Cloak: + InitialDelay: 15 + CloakDelay: 90 + CloakSound: trans1.aud + UncloakSound: trans1.aud + RequiresCondition: cloak + ExternalConditions@CLOAK: + Conditions: cloak + ^Vehicle: Inherits@1: ^ExistsInWorld Inherits@3: ^SpriteActor @@ -152,14 +162,6 @@ Guardable: Tooltip: GenericName: Vehicle - Cloak: - InitialDelay: 15 - CloakDelay: 90 - CloakSound: trans1.aud - UncloakSound: trans1.aud - RequiresCondition: cloak - ExternalConditions@CLOAK: - Conditions: cloak MustBeDestroyed: Voiced: VoiceSet: VehicleVoice diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index d2bde44795..9adc23d032 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -31,12 +31,12 @@ MCV: BaseBuilding: SpawnActorOnDeath: Actor: MCV.Husk - -Cloak: SelectionDecorations: VisualBounds: 36,36 HARV: Inherits: ^Tank + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 1000 Tooltip: @@ -77,6 +77,7 @@ HARV: APC: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 600 Tooltip: @@ -126,6 +127,7 @@ APC: ARTY: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 600 Tooltip: @@ -162,6 +164,7 @@ ARTY: FTNK: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 600 Tooltip: @@ -196,6 +199,7 @@ FTNK: BGGY: Inherits: ^Vehicle Inherits@@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 300 Tooltip: @@ -231,6 +235,7 @@ BGGY: BIKE: Inherits: ^Vehicle Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 500 Tooltip: @@ -268,6 +273,7 @@ BIKE: JEEP: Inherits: ^Vehicle Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 400 Tooltip: @@ -303,6 +309,7 @@ JEEP: LTNK: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 700 Tooltip: @@ -339,6 +346,7 @@ LTNK: MTNK: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 800 Tooltip: @@ -376,6 +384,7 @@ MTNK: HTNK: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 1500 Tooltip: @@ -426,6 +435,7 @@ HTNK: MSAM: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 1000 Tooltip: @@ -463,6 +473,7 @@ MSAM: MLRS: Inherits: ^Tank Inherits@EXPERIENCE: ^GainsExperience + Inherits@CLOAK: ^AcceptsCloakCrate Valued: Cost: 600 Tooltip: @@ -526,7 +537,6 @@ STNK: RevealsShroud: Range: 7c0 Cloak: - -RequiresCondition: InitialDelay: 90 CloakDelay: 90 CloakSound: trans1.aud From 623842d699985315170353001adcd3867ba55fc4 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 19:58:05 +0000 Subject: [PATCH 05/14] Fix RA aircraft conditions. --- mods/ra/rules/defaults.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 157ae8fe77..8c24664f1c 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -428,7 +428,6 @@ RepairBuildings: fix RearmBuildings: afld AirborneCondition: airborne - CruisingCondition: cruising Targetable@GROUND: TargetTypes: Ground, Repair, Vehicle RequiresCondition: !airborne @@ -470,6 +469,7 @@ Aircraft: RearmBuildings: hpad CanHover: True + CruisingCondition: cruising GpsDot: String: Helicopter Hovers@CRUISING: @@ -798,8 +798,6 @@ Tooltip: GenericName: Destroyed Plane Aircraft: - AirborneCondition: airborne - CruisingCondition: cruising FallsToEarth: Spins: False Moves: True @@ -813,8 +811,6 @@ Tooltip: GenericName: Destroyed Helicopter Aircraft: - AirborneCondition: airborne - CruisingCondition: cruising CanHover: True FallsToEarth: BodyOrientation: From 0145bfc0c0e1100513d46c3446ff9e6a3eee4832 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 20:00:52 +0000 Subject: [PATCH 06/14] Work around RA aircraft inherits. --- mods/ra/rules/aircraft.yaml | 9 +++------ mods/ra/rules/defaults.yaml | 7 +++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ra/rules/aircraft.yaml b/mods/ra/rules/aircraft.yaml index ee450ed9d8..fcd598bc3f 100644 --- a/mods/ra/rules/aircraft.yaml +++ b/mods/ra/rules/aircraft.yaml @@ -1,5 +1,5 @@ BADR: - Inherits: ^Plane + Inherits: ^NeutralPlane ParaDrop: DropRange: 4c0 Health: @@ -18,7 +18,6 @@ BADR: SelectionDecorations: RenderSelectionBars: False -Voiced: - -GainsExperience: Tooltip: Name: Badger Contrail@1: @@ -39,7 +38,7 @@ BADR: Experience: 1000 BADR.Bomber: - Inherits: ^Plane + Inherits: ^NeutralPlane AttackBomber: Armament: Weapon: ParaBomb @@ -59,7 +58,6 @@ BADR.Bomber: SelectionDecorations: RenderSelectionBars: False -Voiced: - -GainsExperience: Tooltip: Name: Badger Contrail@1: @@ -358,7 +356,7 @@ HIND: Prerequisites: aircraft.upgraded U2: - Inherits: ^Plane + Inherits: ^NeutralPlane Health: HP: 2000 Tooltip: @@ -377,7 +375,6 @@ U2: RenderSelectionBars: False -Voiced: -Targetable@AIRBORNE: - -GainsExperience: Contrail@1: Offset: -725,683,0 Contrail@2: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 8c24664f1c..15d749bee7 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -410,9 +410,8 @@ VoiceSet: VehicleVoice WithFacingSpriteBody: -^Plane: +^NeutralPlane: Inherits@1: ^ExistsInWorld - Inherits@2: ^GainsExperience Inherits@3: ^IronCurtainable Inherits@4: ^SpriteActor Huntable: @@ -462,6 +461,10 @@ Voiced: VoiceSet: GenericVoice +^Plane: + Inherits: ^NeutralPlane + Inherits@2: ^GainsExperience + ^Helicopter: Inherits: ^Plane Tooltip: From 5979819d9b911d19a916cb7be0f410c5af5a713f Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 20:06:13 +0000 Subject: [PATCH 07/14] Work around RA experience inherits. --- mods/ra/maps/soviet-03/rules.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ra/maps/soviet-03/rules.yaml b/mods/ra/maps/soviet-03/rules.yaml index 02ccae0752..199bf660d9 100644 --- a/mods/ra/maps/soviet-03/rules.yaml +++ b/mods/ra/maps/soviet-03/rules.yaml @@ -57,7 +57,10 @@ V05: Actor: healcrate DOG: + # HACK: Disable experience without killing the linter -GainsExperience: + ExternalConditions@EXPERIENCE: + Conditions: rank-veteran-1, rank-veteran-2, rank-veteran-3, rank-elite SPY: Mobile: From a6f25438c3f9b8f87f455b282844f7ce2f67a591 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 20:09:00 +0000 Subject: [PATCH 08/14] Remove bogus ExternalConditions from fort-lonestar. --- mods/ra/maps/fort-lonestar/rules.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/ra/maps/fort-lonestar/rules.yaml b/mods/ra/maps/fort-lonestar/rules.yaml index b7fe962f65..2c2183987f 100644 --- a/mods/ra/maps/fort-lonestar/rules.yaml +++ b/mods/ra/maps/fort-lonestar/rules.yaml @@ -28,8 +28,6 @@ World: Type: LightningStrike LuaScript: Scripts: fort-lonestar.lua, fort-lonestar-AI.lua - ExternalConditions: - Conditions: invulnerability MapBuildRadius: AllyBuildRadiusLocked: True AllyBuildRadiusEnabled: True From 4a179e48241999051f1cda776e3fe47fdc5f2ae0 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 20:24:55 +0000 Subject: [PATCH 09/14] Remove ^EmpDisableMobile inherit. --- mods/ts/rules/civilian-vehicles.yaml | 4 ++++ mods/ts/rules/defaults.yaml | 16 +++++++--------- mods/ts/rules/gdi-vehicles.yaml | 1 + mods/ts/rules/nod-vehicles.yaml | 2 ++ mods/ts/rules/shared-vehicles.yaml | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mods/ts/rules/civilian-vehicles.yaml b/mods/ts/rules/civilian-vehicles.yaml index ec81344d6b..470a3f2e34 100644 --- a/mods/ts/rules/civilian-vehicles.yaml +++ b/mods/ts/rules/civilian-vehicles.yaml @@ -90,6 +90,7 @@ BUS: Mobile: TurnSpeed: 5 Speed: 113 + RequiresCondition: !empdisable && !loading Health: HP: 100 Armor: @@ -114,6 +115,7 @@ PICK: Mobile: TurnSpeed: 5 Speed: 113 + RequiresCondition: !empdisable && !loading Health: HP: 100 Armor: @@ -138,6 +140,7 @@ CAR: Mobile: TurnSpeed: 5 Speed: 113 + RequiresCondition: !empdisable && !loading Health: HP: 100 Armor: @@ -162,6 +165,7 @@ WINI: Mobile: TurnSpeed: 5 Speed: 113 + RequiresCondition: !empdisable && !loading Health: HP: 200 Armor: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 70809b20e0..2c4bc455cf 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -88,11 +88,6 @@ ExternalConditions@EMPDISABLE: Conditions: empdisable -^EmpDisableMobile: - Inherits: ^EmpDisable - Mobile: - RequiresCondition: !empdisable && !deployed && !loading - ^Cloakable: Cloak@EXTERNALCLOAK: RequiresCondition: cloakgenerator || crate-cloak @@ -401,7 +396,7 @@ ^Cyborg: Inherits@1: ^Infantry - Inherits@2: ^EmpDisableMobile + Inherits@2: ^EmpDisable Inherits@3: ^HealsOnTiberium ExplosionOnDamageTransition: Weapon: CyborgExplode @@ -425,6 +420,8 @@ SpeedMultiplier@CRITICAL: RequiresCondition: criticalspeed Modifier: 50 + Mobile: + RequiresCondition: !empdisable ^CivilianInfantry: Inherits@1: ^Infantry @@ -441,7 +438,7 @@ ^Vehicle: Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld - Inherits@3: ^EmpDisableMobile + Inherits@3: ^EmpDisable Inherits@4: ^Cloakable Inherits@5: ^DamagedByVeins Huntable: @@ -461,6 +458,7 @@ PathingCost: 90 TurnSpeed: 5 Voice: Move + RequiresCondition: !empdisable Selectable: Bounds: 40,24 WithTextControlGroupDecoration: @@ -784,7 +782,7 @@ ActorLostNotification: ^Train: - Inherits@1: ^EmpDisableMobile + Inherits@1: ^EmpDisable Inherits@2: ^ExistsInWorld Inherits@3: ^Cloakable Huntable: @@ -799,10 +797,10 @@ TurnSpeed: 5 Voice: Move Speed: 113 + RequiresCondition: !empdisable Cargo: Types: Infantry UnloadVoice: Unload - LoadingCondition: loading Health: HP: 100 Armor: diff --git a/mods/ts/rules/gdi-vehicles.yaml b/mods/ts/rules/gdi-vehicles.yaml index 21312e62a3..db49ca0418 100644 --- a/mods/ts/rules/gdi-vehicles.yaml +++ b/mods/ts/rules/gdi-vehicles.yaml @@ -14,6 +14,7 @@ APC: Speed: 113 TerrainSpeeds: Water: 80 + RequiresCondition: !empdisable && !loading Health: HP: 200 Armor: diff --git a/mods/ts/rules/nod-vehicles.yaml b/mods/ts/rules/nod-vehicles.yaml index 8c1259b06f..00cfbe8f45 100644 --- a/mods/ts/rules/nod-vehicles.yaml +++ b/mods/ts/rules/nod-vehicles.yaml @@ -84,6 +84,7 @@ TTNK: TurnSpeed: 5 Speed: 85 Crushes: wall, crate, infantry + RequiresCondition: !empdisable && undeployed Health: HP: 350 Armor: @@ -273,6 +274,7 @@ SAPC: Mobile: TurnSpeed: 5 Speed: 71 + RequiresCondition: !empdisable && !loading Health: HP: 175 Armor: diff --git a/mods/ts/rules/shared-vehicles.yaml b/mods/ts/rules/shared-vehicles.yaml index 282fe137e7..ee516ad5b6 100644 --- a/mods/ts/rules/shared-vehicles.yaml +++ b/mods/ts/rules/shared-vehicles.yaml @@ -127,6 +127,7 @@ LPST: Mobile: Speed: 85 TurnSpeed: 5 + RequiresCondition: !empdisable && undeployed RevealsShroud: Range: 7c0 MaxHeightDelta: 3 From 72589ae9679b5f18ae5e10fccf44054448bbff73 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 20:25:51 +0000 Subject: [PATCH 10/14] Fix TS aircraft conditions. --- mods/ts/rules/aircraft.yaml | 3 ++- mods/ts/rules/defaults.yaml | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml index bb2cdeea07..394ffaba84 100644 --- a/mods/ts/rules/aircraft.yaml +++ b/mods/ts/rules/aircraft.yaml @@ -121,7 +121,7 @@ ORCAB: MaximumPitch: 120 TurnSpeed: 3 Speed: 96 - AirborneCondition: airborne + CruisingCondition: cruising MoveIntoShroud: false TakeoffSound: orcaup1.aud LandingSound: orcadwn1.aud @@ -338,6 +338,7 @@ HUNTER: Speed: 355 CruiseAltitude: 256 CanHover: True + CruisingCondition: cruising Targetable: TargetTypes: Ground, Vehicle HiddenUnderFog: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 2c4bc455cf..ee0ce1d94f 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -568,7 +568,6 @@ Palette: pips Aircraft: AirborneCondition: airborne - CruisingCondition: cruising RepairBuildings: gadept RearmBuildings: gahpad, nahpad LandWhenIdle: false @@ -596,6 +595,7 @@ Aircraft: CruiseAltitude: 2048 CanHover: True + CruisingCondition: cruising Hovers@CRUISING: RequiresCondition: cruising @@ -613,8 +613,6 @@ QuantizedFacings: 0 CameraPitch: 90 Aircraft: - AirborneCondition: airborne - CruisingCondition: cruising Health: HP: 280 Armor: From 72f61ed95ce786bbd6b9318abbba72eca3a045ec Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 20:51:01 +0000 Subject: [PATCH 11/14] Start reorganising TS Inherits. --- mods/ts/rules/aircraft.yaml | 12 +++++-- mods/ts/rules/civilian-infantry.yaml | 5 +++ mods/ts/rules/civilian-vehicles.yaml | 4 ++- mods/ts/rules/defaults.yaml | 50 ++-------------------------- mods/ts/rules/gdi-infantry.yaml | 4 +++ mods/ts/rules/gdi-vehicles.yaml | 17 +++++++--- mods/ts/rules/nod-infantry.yaml | 3 ++ mods/ts/rules/nod-support.yaml | 27 ++++++++++++++- mods/ts/rules/nod-vehicles.yaml | 34 +++++++++++++------ mods/ts/rules/shared-infantry.yaml | 2 +- mods/ts/rules/shared-vehicles.yaml | 11 +++--- 11 files changed, 97 insertions(+), 72 deletions(-) diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml index 394ffaba84..a2b559a14a 100644 --- a/mods/ts/rules/aircraft.yaml +++ b/mods/ts/rules/aircraft.yaml @@ -64,6 +64,7 @@ DSHP: ORCA: Inherits: ^Helicopter + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1000 Tooltip: @@ -104,7 +105,8 @@ ORCA: Actor: ORCA.Husk ORCAB: - Inherits: ^Plane + Inherits: ^Aircraft + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1600 Tooltip: @@ -125,6 +127,7 @@ ORCAB: MoveIntoShroud: false TakeoffSound: orcaup1.aud LandingSound: orcadwn1.aud + ReturnOnIdle: Health: HP: 260 Armor: @@ -225,7 +228,8 @@ TRNSPORT: Actor: TRNSPORT.Husk SCRIN: - Inherits: ^Plane + Inherits: ^Aircraft + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1500 Tooltip: @@ -240,6 +244,7 @@ SCRIN: Voiced: VoiceSet: Scrin Aircraft: + CruiseAltitude: 2560 MaximumPitch: 90 TurnSpeed: 3 Speed: 168 @@ -247,6 +252,7 @@ SCRIN: MoveIntoShroud: false TakeoffSound: dropup1.aud LandingSound: dropdwn1.aud + ReturnOnIdle: Health: HP: 280 Armor: @@ -273,6 +279,7 @@ SCRIN: APACHE: Inherits: ^Helicopter + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1000 Tooltip: @@ -319,7 +326,6 @@ APACHE: Actor: APACHE.Husk HUNTER: - Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld Valued: Cost: 1000 diff --git a/mods/ts/rules/civilian-infantry.yaml b/mods/ts/rules/civilian-infantry.yaml index 8b5ce6436e..442f1605ab 100644 --- a/mods/ts/rules/civilian-infantry.yaml +++ b/mods/ts/rules/civilian-infantry.yaml @@ -26,6 +26,7 @@ WEEDGUY: UMAGON: Inherits: ^Soldier Inherits@2: ^HealsOnTiberium + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 400 Tooltip: @@ -82,6 +83,7 @@ CHAMSPY: MUTANT: Inherits: ^Soldier Inherits@2: ^HealsOnTiberium + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 100 Tooltip: @@ -106,6 +108,7 @@ MUTANT: MWMN: Inherits: ^Soldier Inherits@2: ^HealsOnTiberium + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 100 Tooltip: @@ -130,6 +133,7 @@ MWMN: MUTANT3: Inherits: ^Soldier Inherits@2: ^HealsOnTiberium + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 100 Tooltip: @@ -210,6 +214,7 @@ DOGGIE: Inherits@1: ^Infantry Inherits@2: ^RegularInfantryDeath Inherits@3: ^HealsOnTiberium + Inherits@EXPERIENCE: ^GainsExperience Tooltip: Name: Tiberian Fiend Health: diff --git a/mods/ts/rules/civilian-vehicles.yaml b/mods/ts/rules/civilian-vehicles.yaml index 470a3f2e34..d2e66cec8b 100644 --- a/mods/ts/rules/civilian-vehicles.yaml +++ b/mods/ts/rules/civilian-vehicles.yaml @@ -1,5 +1,7 @@ 4TNK: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1700 Tooltip: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index ee0ce1d94f..5f44e689fb 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -252,7 +252,6 @@ RenderSprites: ^Infantry: - Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld Inherits@3: ^SpriteActor Inherits@4: ^Cloakable @@ -436,7 +435,6 @@ MaxMoveDelay: 750 ^Vehicle: - Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld Inherits@3: ^EmpDisable Inherits@4: ^Cloakable @@ -525,22 +523,15 @@ BlueTiberium: 70 Veins: 70 -^VoxelVehicle: - Inherits: ^Vehicle - BodyOrientation: - QuantizedFacings: 0 - RenderVoxels: - WithVoxelBody: - -^VoxelTank: - Inherits: ^Tank +^VoxelActor: BodyOrientation: QuantizedFacings: 0 RenderVoxels: WithVoxelBody: ^CivilianVoxelVehicle: - Inherits: ^VoxelVehicle + Inherits: ^Vehicle + Inherits: ^VoxelActor -MustBeDestroyed: ^CivilianVoxelCrusher: @@ -549,7 +540,6 @@ Crushes: wall, crate, infantry ^Aircraft: - Inherits@1: ^GainsExperience Inherits@2: ^ExistsInWorld Inherits@3: ^Cloakable Huntable: @@ -599,12 +589,6 @@ Hovers@CRUISING: RequiresCondition: cruising -^Plane: - Inherits: ^Aircraft - Aircraft: - CruiseAltitude: 2560 - ReturnOnIdle: - ^AircraftHusk: RenderVoxels: RenderSprites: @@ -751,34 +735,6 @@ DetectCloaked: Range: 5c0 -^DeployedVehicle: - Inherits@1: ^GainsExperience - Inherits@2: ^ExistsInWorld - Inherits@3: ^SpriteActor - Huntable: - Voiced: - VoiceSet: Vehicle - AttackTurreted: - Voice: Attack - AutoTarget: - RenderRangeCircle: - DrawLineToTarget: - Building: - Dimensions: 1,1 - Footprint: x - TerrainTypes: Clear, Road, DirtRoad, Rough - WithSpriteBody: - WithMakeAnimation: - WithTextControlGroupDecoration: - SelectionDecorations: - Palette: pips - Selectable: - Targetable: - TargetTypes: Ground, Building, Repair - Guardable: - HiddenUnderFog: - ActorLostNotification: - ^Train: Inherits@1: ^EmpDisable Inherits@2: ^ExistsInWorld diff --git a/mods/ts/rules/gdi-infantry.yaml b/mods/ts/rules/gdi-infantry.yaml index 9d57b86ad7..0c3eb63c06 100644 --- a/mods/ts/rules/gdi-infantry.yaml +++ b/mods/ts/rules/gdi-infantry.yaml @@ -1,5 +1,6 @@ E2: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Buildable: Queue: Infantry BuildPaletteOrder: 20 @@ -26,6 +27,7 @@ E2: MEDIC: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -61,6 +63,7 @@ MEDIC: JUMPJET: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -95,6 +98,7 @@ JUMPJET: GHOST: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Inherits@2: ^HealsOnTiberium Valued: Cost: 1750 diff --git a/mods/ts/rules/gdi-vehicles.yaml b/mods/ts/rules/gdi-vehicles.yaml index db49ca0418..a13cde5c02 100644 --- a/mods/ts/rules/gdi-vehicles.yaml +++ b/mods/ts/rules/gdi-vehicles.yaml @@ -1,5 +1,6 @@ APC: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor Valued: Cost: 800 Tooltip: @@ -47,7 +48,9 @@ APC: MovingInterval: 6 HVR: - Inherits: ^VoxelVehicle + Inherits: ^Vehicle + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 900 Tooltip: @@ -101,6 +104,7 @@ HVR: SMECH: Inherits: ^Vehicle + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 500 Tooltip: @@ -143,6 +147,7 @@ SMECH: MMCH: Inherits: ^Tank + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 800 Tooltip: @@ -190,7 +195,9 @@ MMCH: LocalOffset: 0, 0, 408 HMEC: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 3000 Tooltip: @@ -231,7 +238,9 @@ HMEC: LocalOffset: 0, 0, 360 SONIC: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1300 Tooltip: diff --git a/mods/ts/rules/nod-infantry.yaml b/mods/ts/rules/nod-infantry.yaml index c070811f68..482128e2d2 100644 --- a/mods/ts/rules/nod-infantry.yaml +++ b/mods/ts/rules/nod-infantry.yaml @@ -1,5 +1,6 @@ E3: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Buildable: Queue: Infantry BuildPaletteOrder: 20 @@ -27,6 +28,7 @@ E3: CYBORG: Inherits: ^Cyborg + Inherits@EXPERIENCE: ^GainsExperience Armor: Type: Light Valued: @@ -60,6 +62,7 @@ CYBORG: CYC2: Inherits: ^Cyborg + Inherits@EXPERIENCE: ^GainsExperience Armor: Type: Heavy Valued: diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index d2ee181bcf..62606a522c 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -160,7 +160,32 @@ NASAM: VisualBounds: 40, 36, -3, -8 GAARTY: - Inherits@1: ^DeployedVehicle + Inherits@1: ^GainsExperience + Inherits@2: ^ExistsInWorld + Inherits@3: ^SpriteActor + Huntable: + Voiced: + VoiceSet: Vehicle + AttackTurreted: + Voice: Attack + AutoTarget: + RenderRangeCircle: + DrawLineToTarget: + Building: + Dimensions: 1,1 + Footprint: x + TerrainTypes: Clear, Road, DirtRoad, Rough + WithSpriteBody: + WithMakeAnimation: + WithTextControlGroupDecoration: + SelectionDecorations: + Palette: pips + Selectable: + Targetable: + TargetTypes: Ground, Building, Repair + Guardable: + HiddenUnderFog: + ActorLostNotification: Valued: Cost: 975 Tooltip: diff --git a/mods/ts/rules/nod-vehicles.yaml b/mods/ts/rules/nod-vehicles.yaml index 00cfbe8f45..bdf5be7144 100644 --- a/mods/ts/rules/nod-vehicles.yaml +++ b/mods/ts/rules/nod-vehicles.yaml @@ -1,5 +1,7 @@ BGGY: - Inherits: ^VoxelVehicle + Inherits: ^Vehicle + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 500 Tooltip: @@ -33,7 +35,9 @@ BGGY: -WithIdleOverlay@VEINS: BIKE: - Inherits: ^VoxelVehicle + Inherits: ^Vehicle + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 600 Tooltip: @@ -66,7 +70,9 @@ BIKE: AutoTarget: TTNK: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 800 Tooltip: @@ -161,7 +167,9 @@ TTNK: RequiresCondition: undeployed ART2: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 975 Tooltip: @@ -191,7 +199,8 @@ ART2: Voice: Move REPAIR: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor Buildable: Queue: Vehicle BuildPaletteOrder: 70 @@ -219,7 +228,8 @@ REPAIR: Voice: Attack WEED: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor Valued: Cost: 1400 Tooltip: @@ -255,13 +265,13 @@ WEED: MaxHeightDelta: 3 -WithVoxelBody: WithVoxelUnloadBody: - -GainsExperience: -DamagedByTerrain@VEINS: -GrantConditionOnTerrain@VEINS: -WithIdleOverlay@VEINS: SAPC: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor Valued: Cost: 800 Tooltip: @@ -291,7 +301,9 @@ SAPC: EjectOnDeath: true SUBTANK: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 750 Tooltip: @@ -319,7 +331,9 @@ SUBTANK: AutoTarget: STNK: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor + Inherits@EXPERIENCE: ^GainsExperience Valued: Cost: 1100 Tooltip: diff --git a/mods/ts/rules/shared-infantry.yaml b/mods/ts/rules/shared-infantry.yaml index 6855a769f3..fbd310fadc 100644 --- a/mods/ts/rules/shared-infantry.yaml +++ b/mods/ts/rules/shared-infantry.yaml @@ -1,5 +1,6 @@ E1: Inherits: ^Soldier + Inherits@EXPERIENCE: ^GainsExperience Buildable: Queue: Infantry BuildPaletteOrder: 10 @@ -57,7 +58,6 @@ ENGINEER: CaptureTypes: building PlayerExperience: 50 -AutoTarget: - -GainsExperience: RenderSprites: Image: engineer.gdi FactionImages: diff --git a/mods/ts/rules/shared-vehicles.yaml b/mods/ts/rules/shared-vehicles.yaml index ee516ad5b6..1724dbae33 100644 --- a/mods/ts/rules/shared-vehicles.yaml +++ b/mods/ts/rules/shared-vehicles.yaml @@ -1,5 +1,6 @@ MCV: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor Buildable: Queue: Vehicle BuildPaletteOrder: 110 @@ -39,7 +40,8 @@ MCV: nod: mcv.nod HARV: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor Valued: Cost: 1400 Tooltip: @@ -84,7 +86,6 @@ HARV: RevealsShroud: Range: 4c0 MaxHeightDelta: 3 - -GainsExperience: -WithVoxelBody: WithVoxelUnloadBody: Explodes: @@ -104,9 +105,9 @@ HARV: -WithIdleOverlay@VEINS: LPST: - Inherits: ^VoxelTank + Inherits: ^Tank + Inherits@VOXELS: ^VoxelActor -AppearsOnRadar: - -GainsExperience: Buildable: Queue: Vehicle BuildPaletteOrder: 100 From 2e8479b9a20314b2058dd0cd62a93bb5add93eec Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 21:06:12 +0000 Subject: [PATCH 12/14] Split out and reset crate stat modifier bonuses. --- mods/ts/rules/civilian-infantry.yaml | 1 + mods/ts/rules/defaults.yaml | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/mods/ts/rules/civilian-infantry.yaml b/mods/ts/rules/civilian-infantry.yaml index 442f1605ab..26a89d862f 100644 --- a/mods/ts/rules/civilian-infantry.yaml +++ b/mods/ts/rules/civilian-infantry.yaml @@ -263,6 +263,7 @@ VISC_SML: VISC_LRG: Inherits: ^Visceroid + Inherits@CRATESTATS: ^CrateStatModifiers Tooltip: Name: Adult Visceroid Health: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 5f44e689fb..0f7f9aace2 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -21,22 +21,22 @@ 500: rank-veteran 1000: rank-elite FirepowerMultiplier@VETERAN: - RequiresCondition: (rank-veteran && !rank-elite) || crate-firepower + RequiresCondition: rank-veteran && !rank-elite Modifier: 110 FirepowerMultiplier@ELITE: - RequiresCondition: rank-elite || (rank-veteran && crate-firepower) + RequiresCondition: rank-elite Modifier: 130 DamageMultiplier@VETERAN: - RequiresCondition: (rank-veteran && !rank-elite) || crate-damage + RequiresCondition: rank-veteran && !rank-elite Modifier: 90 DamageMultiplier@ELITE: - RequiresCondition: rank-elite || (rank-veteran && crate-damage) + RequiresCondition: rank-elite Modifier: 75 SpeedMultiplier@VETERAN: - RequiresCondition: (rank-veteran && !rank-elite) || crate-speed + RequiresCondition: rank-veteran && !rank-elite Modifier: 120 SpeedMultiplier@ELITE: - RequiresCondition: rank-elite || (rank-veteran && crate-speed) + RequiresCondition: rank-elite Modifier: 140 ReloadDelayMultiplier@VETERAN: RequiresCondition: rank-veteran && !rank-elite @@ -64,8 +64,19 @@ ReferencePoint: Bottom, Right RequiresCondition: rank-elite ZOffset: 256 + +^CrateStatModifiers: + FirepowerMultiplier@CRATES: + RequiresCondition: crate-firepower + Modifier: 200 + DamageMultiplier@CRATES: + RequiresCondition: crate-damage + Modifier: 50 + SpeedMultiplier@CRATES: + RequiresCondition: crate-speed + Modifier: 170 ExternalConditions@CRATES: - Conditions: crate-firepower, crate-damage, crate-speed, crate-cloak + Conditions: crate-firepower, crate-damage, crate-speed ^EmpDisable: UpgradeOverlay@EMPDISABLE: @@ -255,6 +266,7 @@ Inherits@2: ^ExistsInWorld Inherits@3: ^SpriteActor Inherits@4: ^Cloakable + Inherits@CRATESTATS: ^CrateStatModifiers Huntable: DrawLineToTarget: Health: @@ -439,6 +451,7 @@ Inherits@3: ^EmpDisable Inherits@4: ^Cloakable Inherits@5: ^DamagedByVeins + Inherits@CRATESTATS: ^CrateStatModifiers Huntable: DrawLineToTarget: Mobile: From 2d8db8ddd25e684293d7785296a8259524f5fa1b Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 21:07:56 +0000 Subject: [PATCH 13/14] Fix GALITE conditions. --- mods/ts/rules/civilian-structures.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ts/rules/civilian-structures.yaml b/mods/ts/rules/civilian-structures.yaml index 8ea04c9022..536a510c32 100644 --- a/mods/ts/rules/civilian-structures.yaml +++ b/mods/ts/rules/civilian-structures.yaml @@ -1264,6 +1264,7 @@ GALITE: SelectionDecorations: VisualBounds: 25, 35, 0, -12 -Cloak@EXTERNALCLOAK: + -ExternalConditions@EXTERNALCLOAK: TSTLAMP: Inherits: GALITE From f787f275db740e27544472f1c1d30b38d98e8af3 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Dec 2016 19:35:52 +0000 Subject: [PATCH 14/14] Add actor conditions lint rule. --- OpenRA.Mods.Common/Lint/CheckConditions.cs | 72 ++++++++++++++++++++ OpenRA.Mods.Common/Lint/LintExts.cs | 30 ++++++-- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 + 3 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 OpenRA.Mods.Common/Lint/CheckConditions.cs diff --git a/OpenRA.Mods.Common/Lint/CheckConditions.cs b/OpenRA.Mods.Common/Lint/CheckConditions.cs new file mode 100644 index 0000000000..2a2b54c640 --- /dev/null +++ b/OpenRA.Mods.Common/Lint/CheckConditions.cs @@ -0,0 +1,72 @@ +#region Copyright & License Information +/* + * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using OpenRA.Mods.Common.Traits; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Lint +{ + public class CheckConditions : ILintRulesPass + { + public void Run(Action emitError, Action emitWarning, Ruleset rules) + { + foreach (var actorInfo in rules.Actors) + { + if (actorInfo.Key.StartsWith("^", StringComparison.Ordinal)) + continue; + + var granted = new HashSet(); + var consumed = new HashSet(); + + foreach (var trait in actorInfo.Value.TraitInfos()) + { + var fieldConsumed = trait.GetType().GetFields() + .Where(x => x.HasAttribute()) + .SelectMany(f => LintExts.GetFieldValues(trait, f, emitError)); + + var propertyConsumed = trait.GetType().GetProperties() + .Where(x => x.HasAttribute()) + .SelectMany(p => LintExts.GetPropertyValues(trait, p, emitError)); + + var fieldGranted = trait.GetType().GetFields() + .Where(x => x.HasAttribute()) + .SelectMany(f => LintExts.GetFieldValues(trait, f, emitError)); + + var propertyGranted = trait.GetType().GetProperties() + .Where(x => x.HasAttribute()) + .SelectMany(f => LintExts.GetPropertyValues(trait, f, emitError)); + + foreach (var c in fieldConsumed.Concat(propertyConsumed)) + if (!string.IsNullOrEmpty(c)) + consumed.Add(c); + + foreach (var g in fieldGranted.Concat(propertyGranted)) + if (!string.IsNullOrEmpty(g)) + granted.Add(g); + } + + var unconsumed = granted.Except(consumed); + if (unconsumed.Any()) + emitWarning("Actor type `{0}` grants conditions that are not consumed: {1}".F(actorInfo.Key, unconsumed.JoinWith(", "))); + + var ungranted = consumed.Except(granted); + 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) + emitError("Actor type `{0}` defines conditions but does not include an UpgradeManager".F(actorInfo.Key)); + } + } + } +} \ No newline at end of file diff --git a/OpenRA.Mods.Common/Lint/LintExts.cs b/OpenRA.Mods.Common/Lint/LintExts.cs index 582573790e..f5420e2d54 100644 --- a/OpenRA.Mods.Common/Lint/LintExts.cs +++ b/OpenRA.Mods.Common/Lint/LintExts.cs @@ -10,6 +10,7 @@ #endregion using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -24,20 +25,37 @@ namespace OpenRA.Mods.Common.Lint var type = fieldInfo.FieldType; if (type == typeof(string)) return new[] { (string)fieldInfo.GetValue(ruleInfo) }; - if (type == typeof(string[])) - return (string[])fieldInfo.GetValue(ruleInfo); - if (type == typeof(HashSet)) - return (HashSet)fieldInfo.GetValue(ruleInfo); + + if (typeof(IEnumerable).IsAssignableFrom(type)) + return fieldInfo.GetValue(ruleInfo) as IEnumerable; + if (type == typeof(BooleanExpression)) { var expr = (BooleanExpression)fieldInfo.GetValue(ruleInfo); return expr != null ? expr.Variables : Enumerable.Empty(); } - emitError("Bad type for reference on {0}.{1}. Supported types: string, string[], HashSet, BooleanExpression" + throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: string, IEnumerable, BooleanExpression" .F(ruleInfo.GetType().Name, fieldInfo.Name)); + } - return new string[] { }; + public static IEnumerable GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo, Action emitError) + { + var type = propertyInfo.PropertyType; + if (type == typeof(string)) + return new[] { (string)propertyInfo.GetValue(ruleInfo) }; + + if (typeof(IEnumerable).IsAssignableFrom(type)) + return (IEnumerable)propertyInfo.GetValue(ruleInfo); + + if (type == typeof(BooleanExpression)) + { + var expr = (BooleanExpression)propertyInfo.GetValue(ruleInfo); + return expr != null ? expr.Variables : Enumerable.Empty(); + } + + throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: string, IEnumerable, BooleanExpression" + .F(ruleInfo.GetType().Name, propertyInfo.Name)); } } } diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index debbc18184..7aea862391 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -181,6 +181,7 @@ +