Rename comments and documentation.

This commit is contained in:
Paul Chote
2016-12-23 15:17:02 +00:00
parent 152ae13cea
commit d0270ab866
18 changed files with 36 additions and 37 deletions

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Lint
emitError("Actor type `{0}` consumes conditions that are not granted: {1}".F(actorInfo.Key, ungranted.JoinWith(", "))); emitError("Actor type `{0}` consumes conditions that are not granted: {1}".F(actorInfo.Key, ungranted.JoinWith(", ")));
if ((consumed.Any() || granted.Any()) && actorInfo.Value.TraitInfoOrDefault<ConditionManagerInfo>() == null) if ((consumed.Any() || granted.Any()) && actorInfo.Value.TraitInfoOrDefault<ConditionManagerInfo>() == null)
emitError("Actor type `{0}` defines conditions but does not include an UpgradeManager".F(actorInfo.Key)); emitError("Actor type `{0}` defines conditions but does not include a ConditionManager".F(actorInfo.Key));
} }
} }
} }

View File

@@ -661,7 +661,7 @@ namespace OpenRA.Mods.Common.Traits
OnAirborneAltitudeLeft(); OnAirborneAltitudeLeft();
} }
#region Airborne upgrades #region Airborne conditions
void OnAirborneAltitudeReached() void OnAirborneAltitudeReached()
{ {
@@ -685,7 +685,7 @@ namespace OpenRA.Mods.Common.Traits
#endregion #endregion
#region Cruising upgrades #region Cruising conditions
void OnCruisingAltitudeReached() void OnCruisingAltitudeReached()
{ {

View File

@@ -14,14 +14,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Grants an upgrade to the collector.")] [Desc("Grants a condition on the collector.")]
public class GrantExternalConditionCrateActionInfo : CrateActionInfo public class GrantExternalConditionCrateActionInfo : CrateActionInfo
{ {
[FieldLoader.Require] [FieldLoader.Require]
[Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")]
public readonly string Condition = null; public readonly string Condition = null;
[Desc("Duration of the upgrade (in ticks). Set to 0 for a permanent upgrade.")] [Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")]
public readonly int Duration = 0; public readonly int Duration = 0;
[Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")] [Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")]

View File

@@ -50,11 +50,11 @@ namespace OpenRA.Mods.Common.Traits
{ {
var inRange = self.World.FindActorsInCircle(self.CenterPosition, info.Range).Where(a => var inRange = self.World.FindActorsInCircle(self.CenterPosition, info.Range).Where(a =>
{ {
// Don't upgrade the same unit twice // Don't touch the same unit twice
if (a == collector) if (a == collector)
return false; return false;
// Only upgrade the collecting player's units // Only affect the collecting player's units
// TODO: Also apply to allied units? // TODO: Also apply to allied units?
if (a.Owner != collector.Owner) if (a.Owner != collector.Owner)
return false; return false;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
[FieldLoader.Require] [FieldLoader.Require]
[Desc("Condition to grant at each level.", [Desc("Condition to grant at each level.",
"Key is the XP requirements for each level as a percentage of our own value.", "Key is the XP requirements for each level as a percentage of our own value.",
"Value is a list of the upgrade types to grant")] "Value is the condition to grant.")]
public readonly Dictionary<int, string> Conditions = null; public readonly Dictionary<int, string> Conditions = null;
[GrantedConditionReference] [GrantedConditionReference]

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
public class PlugInfo : TraitInfo<Plug> public class PlugInfo : TraitInfo<Plug>
{ {
[FieldLoader.Require] [FieldLoader.Require]
[Desc("Plug type (matched against Upgrades in Pluggable)")] [Desc("Plug type (matched against Conditions in Pluggable)")]
public readonly string Type = null; public readonly string Type = null;
} }

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits.Render namespace OpenRA.Mods.Common.Traits.Render
{ {
[Desc("Visualizes the remaining time for an upgrade.")] [Desc("Visualizes the remaining time for a condition.")]
class TimedConditionBarInfo : ITraitInfo, Requires<ConditionManagerInfo> class TimedConditionBarInfo : ITraitInfo, Requires<ConditionManagerInfo>
{ {
[FieldLoader.Require] [FieldLoader.Require]

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly int Interval = 750; public readonly int Interval = 750;
[Desc("Pause when the actor is disabled. Deprecated. Use upgrades instead.")] [Desc("Pause when the actor is disabled. Deprecated. Use conditions instead.")]
public readonly bool PauseOnLowPower = false; public readonly bool PauseOnLowPower = false;
public override object Create(ActorInitializer init) { return new WithIdleAnimation(init.Self, this); } public override object Create(ActorInitializer init) { return new WithIdleAnimation(init.Self, this); }

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits.Render
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
} }
// TODO: Get rid of INotifyBuildComplete in favor of using the upgrade system // TODO: Get rid of INotifyBuildComplete in favor of using the condition system
void INotifyBuildComplete.BuildingComplete(Actor self) void INotifyBuildComplete.BuildingComplete(Actor self)
{ {
OnBuildComplete(self); OnBuildComplete(self);

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")]
public readonly string Condition = null; public readonly string Condition = null;
[Desc("Duration of the upgrade (in ticks). Set to 0 for a permanent condition.")] [Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")]
public readonly int Duration = 0; public readonly int Duration = 0;
[Desc("Cells - affects whole cells only")] [Desc("Cells - affects whole cells only")]
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits
readonly SupportPowerManager manager; readonly SupportPowerManager manager;
readonly string order; readonly string order;
public SelectUpgradeTarget(World world, string order, SupportPowerManager manager, GrantExternalConditionPower power) public SelectConditionTarget(World world, string order, SupportPowerManager manager, GrantExternalConditionPower power)
{ {
// Clear selection if using Left-Click Orders // Clear selection if using Left-Click Orders
if (Game.Settings.Game.UseClassicMouseStyle) if (Game.Settings.Game.UseClassicMouseStyle)

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
void Update(int duration, int remaining); void Update(int duration, int remaining);
} }
[Desc("Attach this to a unit to enable dynamic upgrades by warheads, experience, crates, support powers, etc.")] [Desc("Attach this to a unit to enable dynamic conditions by warheads, experience, crates, support powers, etc.")]
public class ConditionManagerInfo : TraitInfo<ConditionManager>, Requires<IConditionConsumerInfo> { } public class ConditionManagerInfo : TraitInfo<ConditionManager>, Requires<IConditionConsumerInfo> { }
public class ConditionManager : INotifyCreated, ITick public class ConditionManager : INotifyCreated, ITick

View File

@@ -13,7 +13,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Disable the actor when this trait is enabled by an upgrade.")] [Desc("Disable the actor when this trait is enabled by a condition.")]
public class DisableOnConditionInfo : UpgradableTraitInfo public class DisableOnConditionInfo : UpgradableTraitInfo
{ {
public override object Create(ActorInitializer init) { return new DisableOnCondition(this); } public override object Create(ActorInitializer init) { return new DisableOnCondition(this); }

View File

@@ -13,7 +13,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Applies an upgrade to the actor at specified damage states.")] [Desc("Applies a condition to the actor at specified damage states.")]
public class GrantConditionOnDamageStateInfo : ITraitInfo, Requires<HealthInfo> public class GrantConditionOnDamageStateInfo : ITraitInfo, Requires<HealthInfo>
{ {
[FieldLoader.Require] [FieldLoader.Require]
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Play a random sound from this list when disabled.")] [Desc("Play a random sound from this list when disabled.")]
public readonly string[] DisabledSounds = { }; public readonly string[] DisabledSounds = { };
[Desc("Levels of damage at which to grant upgrades.")] [Desc("Levels of damage at which to grant the condition.")]
public readonly DamageState ValidDamageStates = DamageState.Heavy | DamageState.Critical; public readonly DamageState ValidDamageStates = DamageState.Heavy | DamageState.Critical;
[Desc("Is the condition irrevocable once it has been activated?")] [Desc("Is the condition irrevocable once it has been activated?")]

View File

@@ -30,8 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant after deploying and revoke before undeploying.")] [Desc("The condition to grant after deploying and revoke before undeploying.")]
public readonly string DeployedCondition = null; public readonly string DeployedCondition = null;
[Desc("The terrain types that this actor can deploy on to receive these upgrades. " + [Desc("The terrain types that this actor can deploy on. Leave empty to allow any.")]
"Leave empty to allow any.")]
public readonly HashSet<string> AllowedTerrainTypes = new HashSet<string>(); public readonly HashSet<string> AllowedTerrainTypes = new HashSet<string>();
[Desc("Can this actor deploy on slopes?")] [Desc("Can this actor deploy on slopes?")]
@@ -207,19 +206,19 @@ namespace OpenRA.Mods.Common.Traits
if (!string.IsNullOrEmpty(info.DeploySound)) if (!string.IsNullOrEmpty(info.DeploySound))
Game.Sound.Play(SoundType.World, info.DeploySound, self.CenterPosition); Game.Sound.Play(SoundType.World, info.DeploySound, self.CenterPosition);
// Revoke upgrades that are used while undeployed. // Revoke condition that is applied while undeployed.
if (!init) if (!init)
OnDeployStarted(); OnDeployStarted();
// If there is no animation to play just grant the upgrades that are used while deployed. // If there is no animation to play just grant the condition that is used while deployed.
// Alternatively, play the deploy animation and then grant the upgrades. // Alternatively, play the deploy animation and then grant the condition.
if (string.IsNullOrEmpty(info.DeployAnimation) || body.Value == null) if (string.IsNullOrEmpty(info.DeployAnimation) || body.Value == null)
OnDeployCompleted(); OnDeployCompleted();
else else
body.Value.PlayCustomAnimation(self, info.DeployAnimation, OnDeployCompleted); body.Value.PlayCustomAnimation(self, info.DeployAnimation, OnDeployCompleted);
} }
/// <summary>Play undeploy sound and animation and after that revoke the upgrades.</summary> /// <summary>Play undeploy sound and animation and after that revoke the condition.</summary>
void Undeploy() { Undeploy(false); } void Undeploy() { Undeploy(false); }
void Undeploy(bool init) void Undeploy(bool init)
{ {
@@ -233,8 +232,8 @@ namespace OpenRA.Mods.Common.Traits
if (!init) if (!init)
OnUndeployStarted(); OnUndeployStarted();
// If there is no animation to play just grant the upgrades that are used while undeployed. // If there is no animation to play just grant the condition that is used while undeployed.
// Alternatively, play the undeploy animation and then grant the upgrades. // Alternatively, play the undeploy animation and then grant the condition.
if (string.IsNullOrEmpty(info.DeployAnimation) || body.Value == null) if (string.IsNullOrEmpty(info.DeployAnimation) || body.Value == null)
OnUndeployCompleted(); OnUndeployCompleted();
else else

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Condition to grant.")] [Desc("Condition to grant.")]
public readonly string Condition = null; public readonly string Condition = null;
[Desc("Apply upgrades on straight vertical movement as well.")] [Desc("Apply condition on straight vertical movement as well.")]
public readonly bool ConsiderVerticalMovement = false; public readonly bool ConsiderVerticalMovement = false;
public override object Create(ActorInitializer init) { return new GrantConditionOnMovement(init.Self, this); } public override object Create(ActorInitializer init) { return new GrantConditionOnMovement(init.Self, this); }

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Condition = null; public readonly string Condition = null;
[FieldLoader.Require] [FieldLoader.Require]
[Desc("Terrain names to trigger the upgrade.")] [Desc("Terrain names to trigger the condition.")]
public readonly string[] TerrainTypes = { }; public readonly string[] TerrainTypes = { };
public object Create(ActorInitializer init) { return new GrantConditionOnTerrain(init, this); } public object Create(ActorInitializer init) { return new GrantConditionOnTerrain(init, this); }

View File

@@ -14,24 +14,24 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Applies an upgrade to actors within a specified range.")] [Desc("Applies a condition to actors within a specified range.")]
public class ProximityExternalConditionInfo : ITraitInfo public class ProximityExternalConditionInfo : ITraitInfo
{ {
[FieldLoader.Require] [FieldLoader.Require]
[Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")]
public readonly string Condition = null; public readonly string Condition = null;
[Desc("The range to search for actors to upgrade.")] [Desc("The range to search for actors.")]
public readonly WDist Range = WDist.FromCells(3); public readonly WDist Range = WDist.FromCells(3);
[Desc("The maximum vertical range above terrain to search for actors to upgrade.", [Desc("The maximum vertical range above terrain to search for actors.",
"Ignored if 0 (actors are upgraded regardless of vertical distance).")] "Ignored if 0 (actors are selected regardless of vertical distance).")]
public readonly WDist MaximumVerticalOffset = WDist.Zero; public readonly WDist MaximumVerticalOffset = WDist.Zero;
[Desc("What diplomatic stances are affected.")] [Desc("What diplomatic stances are affected.")]
public readonly Stance ValidStances = Stance.Ally; public readonly Stance ValidStances = Stance.Ally;
[Desc("Grant the upgrades apply to this actor.")] [Desc("Condition is applied permanently to this actor.")]
public readonly bool AffectsParent = false; public readonly bool AffectsParent = false;
public readonly string EnableSound = null; public readonly string EnableSound = null;
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
if (produced.OccupiesSpace == null) if (produced.OccupiesSpace == null)
return; return;
// We don't grant upgrades when disabled // We don't grant conditions when disabled
if (self.IsDisabled()) if (self.IsDisabled())
return; return;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
public abstract object Create(ActorInitializer init); public abstract object Create(ActorInitializer init);
// HACK: A shim for all the ActorPreview code that used to query UpgradeMinEnabledLevel directly // HACK: A shim for all the ActorPreview code that used to query UpgradeMinEnabledLevel directly
// This can go away after we introduce an InitialUpgrades ActorInit and have the traits query the // This can go away after we introduce an InitialConditions ActorInit and have the traits query the
// condition directly // condition directly
public bool EnabledByDefault { get; private set; } public bool EnabledByDefault { get; private set; }
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Traits
} }
/// <summary> /// <summary>
/// Abstract base for enabling and disabling trait using upgrades. /// Abstract base for enabling and disabling trait using conditions.
/// Requires basing *Info on UpgradableTraitInfo and using base(info) constructor. /// Requires basing *Info on UpgradableTraitInfo and using base(info) constructor.
/// Note that EnabledByUpgrade is not called at creation even if this starts as enabled. /// TraitEnabled will be called at creation if the trait starts enabled or does not use conditions.
/// </summary> /// </summary>
public abstract class UpgradableTrait<InfoType> : IConditionConsumer, IDisabledTrait, INotifyCreated, ISync where InfoType : UpgradableTraitInfo public abstract class UpgradableTrait<InfoType> : IConditionConsumer, IDisabledTrait, INotifyCreated, ISync where InfoType : UpgradableTraitInfo
{ {