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;