Implements an AcknowledgesUpgrade method in UpgradeManager to allow checking for truly applicable upgrades - AcceptsUpgrade returns false if the upgrade has reached max level.
This commit is contained in:
@@ -125,6 +125,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
NotifyUpgradeLevelChanged(s.Traits, self, upgrade, -1);
|
||||
}
|
||||
|
||||
/// <summary>Returns true if the actor uses the given upgrade. Does not check the actual level of the upgrade.</summary>
|
||||
public bool AcknowledgesUpgrade(Actor self, string upgrade)
|
||||
{
|
||||
return upgrades.Value.ContainsKey(upgrade);
|
||||
}
|
||||
|
||||
/// <summary>Returns true only if the actor can accept another level of the upgrade.</summary>
|
||||
public bool AcceptsUpgrade(Actor self, string upgrade)
|
||||
{
|
||||
UpgradeState s;
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
foreach (var u in info.Upgrades)
|
||||
{
|
||||
if (!um.Value.AcceptsUpgrade(self, u))
|
||||
if (!um.Value.AcknowledgesUpgrade(self, u))
|
||||
continue;
|
||||
|
||||
if (Disguised)
|
||||
|
||||
Reference in New Issue
Block a user