diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 6161f5ef86..3d4967f001 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -568,6 +568,7 @@ + diff --git a/OpenRA.Mods.RA/Scripting/Properties/UpgradeProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/UpgradeProperties.cs new file mode 100644 index 0000000000..35d1ae9fc2 --- /dev/null +++ b/OpenRA.Mods.RA/Scripting/Properties/UpgradeProperties.cs @@ -0,0 +1,50 @@ +#region Copyright & License Information +/* + * Copyright 2007-2014 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. For more information, + * see COPYING. + */ +#endregion + +using OpenRA.Scripting; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA.Scripting +{ + [ScriptPropertyGroup("General")] + public class UpgradeProperties : ScriptActorProperties, Requires + { + UpgradeManager um; + public UpgradeProperties(ScriptContext context, Actor self) + : base(context, self) + { + um = self.Trait(); + } + + [Desc("Grant an upgrade to this actor.")] + public void GrantUpgrade(string upgrade) + { + um.GrantUpgrade(self, upgrade, this); + } + + [Desc("Revoke an upgrade that was previously granted using GrantUpgrade.")] + public void RevokeUpgrade(string upgrade) + { + um.RevokeUpgrade(self, upgrade, this); + } + + [Desc("Grant a limited-time upgrade to this actor.")] + public void GrantTimedUpgrade(string upgrade, int duration) + { + um.GrantTimedUpgrade(self, upgrade, duration); + } + + [Desc("Check whether this actor accepts a specific upgrade.")] + public bool AcceptsUpgrade(string upgrade) + { + return um.AcceptsUpgrade(self, upgrade); + } + } +} \ No newline at end of file