Add UpgradeGrantedReferenceAttribute

This commit is contained in:
penev92
2015-06-11 13:35:26 +03:00
parent 2ab7abcee4
commit fbbd9a7eaa
8 changed files with 12 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Traits
[AttributeUsage(AttributeTargets.Field)] [AttributeUsage(AttributeTargets.Field)]
public sealed class SequenceReferenceAttribute : Attribute public sealed class SequenceReferenceAttribute : Attribute
{ {
public readonly string ImageReference; // the field name in the same trait info that contains the image name public readonly string ImageReference; // The field name in the same trait info that contains the image name.
public readonly bool Prefix; public readonly bool Prefix;
public SequenceReferenceAttribute(string imageReference = null, bool prefix = false) public SequenceReferenceAttribute(string imageReference = null, bool prefix = false)
{ {
@@ -37,4 +37,7 @@ namespace OpenRA.Traits
Prefix = prefix; Prefix = prefix;
} }
} }
[AttributeUsage(AttributeTargets.Field)]
public sealed class UpgradeGrantedReferenceAttribute : Attribute { }
} }

View File

@@ -15,6 +15,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Allows granting upgrades to actors from Lua scripts.")] [Desc("Allows granting upgrades to actors from Lua scripts.")]
public class ScriptUpgradesCacheInfo : ITraitInfo public class ScriptUpgradesCacheInfo : ITraitInfo
{ {
[UpgradeGrantedReference]
[Desc("Upgrades that can be granted from the scripts.")] [Desc("Upgrades that can be granted from the scripts.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };

View File

@@ -9,12 +9,14 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Grants an upgrade to the collector.")] [Desc("Grants an upgrade to the collector.")]
public class GrantUpgradeCrateActionInfo : CrateActionInfo public class GrantUpgradeCrateActionInfo : CrateActionInfo
{ {
[UpgradeGrantedReference]
[Desc("The upgrades to apply.")] [Desc("The upgrades to apply.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };

View File

@@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Grants upgrades to the actor this is attached to when prerequisites are available.")] [Desc("Grants upgrades to the actor this is attached to when prerequisites are available.")]
public class GlobalUpgradableInfo : ITraitInfo, Requires<UpgradeManagerInfo> public class GlobalUpgradableInfo : ITraitInfo, Requires<UpgradeManagerInfo>
{ {
[UpgradeGrantedReference]
[Desc("List of upgrades to apply.")] [Desc("List of upgrades to apply.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };

View File

@@ -19,6 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
class GrantUpgradePowerInfo : SupportPowerInfo class GrantUpgradePowerInfo : SupportPowerInfo
{ {
[UpgradeGrantedReference]
[Desc("The upgrades to apply.")] [Desc("The upgrades to apply.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
public class DeployToUpgradeInfo : ITraitInfo, Requires<UpgradeManagerInfo> public class DeployToUpgradeInfo : ITraitInfo, Requires<UpgradeManagerInfo>
{ {
[UpgradeGrantedReference]
[Desc("The upgrades to grant when deploying and revoke when undeploying.")] [Desc("The upgrades to grant when deploying and revoke when undeploying.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Applies an upgrade to actors within a specified range.")] [Desc("Applies an upgrade to actors within a specified range.")]
public class UpgradeActorsNearInfo : ITraitInfo public class UpgradeActorsNearInfo : ITraitInfo
{ {
[UpgradeGrantedReference]
[Desc("The upgrades to grant.")] [Desc("The upgrades to grant.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Warheads
{ {
public class GrantUpgradeWarhead : Warhead public class GrantUpgradeWarhead : Warhead
{ {
[UpgradeGrantedReference]
[Desc("The upgrades to apply.")] [Desc("The upgrades to apply.")]
public readonly string[] Upgrades = { }; public readonly string[] Upgrades = { };