Remove deprecated *Upgrade Lua API methods.

This commit is contained in:
Paul Chote
2019-08-21 09:40:50 +01:00
committed by Matthias Mailänder
parent a10deddf53
commit ed415cb637

View File

@@ -23,8 +23,6 @@ namespace OpenRA.Mods.Common.Scripting
{ {
readonly ExternalCondition[] externalConditions; readonly ExternalCondition[] externalConditions;
readonly Dictionary<string, Stack<int>> legacyShim = new Dictionary<string, Stack<int>>();
public ConditionProperties(ScriptContext context, Actor self) public ConditionProperties(ScriptContext context, Actor self)
: base(context, self) : base(context, self)
{ {
@@ -59,37 +57,5 @@ namespace OpenRA.Mods.Common.Scripting
return externalConditions return externalConditions
.Any(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this)); .Any(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this));
} }
[Desc("Grant an upgrade to this actor. DEPRECATED! Will be removed.")]
public void GrantUpgrade(string upgrade)
{
Game.Debug("GrantUpgrade is deprecated. Use GrantCondition instead.");
legacyShim.GetOrAdd(upgrade).Push(GrantCondition(upgrade));
}
[Desc("Revoke an upgrade that was previously granted using GrantUpgrade. DEPRECATED! Will be removed.")]
public void RevokeUpgrade(string upgrade)
{
Game.Debug("RevokeUpgrade is deprecated. Use RevokeCondition instead.");
Stack<int> tokens;
if (!legacyShim.TryGetValue(upgrade, out tokens) || !tokens.Any())
throw new InvalidDataException("Attempting to revoke upgrade `{0}` that has not been granted.".F(upgrade));
RevokeCondition(tokens.Pop());
}
[Desc("Grant a limited-time upgrade to this actor. DEPRECATED! Will be removed.")]
public void GrantTimedUpgrade(string upgrade, int duration)
{
Game.Debug("GrantTimedUpgrade is deprecated. Use GrantCondition instead.");
GrantCondition(upgrade, duration);
}
[Desc("Check whether this actor accepts a specific upgrade. DEPRECATED! Will be removed.")]
public bool AcceptsUpgrade(string upgrade)
{
Game.Debug("AcceptsUpgrade is deprecated. Use AcceptsCondition instead.");
return AcceptsCondition(upgrade);
}
} }
} }