Fix MCV deploy erasing Iron Curtain history.
This commit is contained in:
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public int GrantCondition(Actor self, object source, int duration = 0)
|
||||
public int GrantCondition(Actor self, object source, int duration = 0, int remaining = 0)
|
||||
{
|
||||
if (!CanGrantCondition(self, source))
|
||||
return ConditionManager.InvalidConditionToken;
|
||||
@@ -100,6 +100,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
HashSet<int> permanent;
|
||||
permanentTokens.TryGetValue(source, out permanent);
|
||||
|
||||
// Callers can override the amount of time remaining by passing a value
|
||||
// between 1 and the duration
|
||||
if (remaining <= 0 || remaining > duration)
|
||||
remaining = duration;
|
||||
|
||||
if (duration > 0)
|
||||
{
|
||||
// Check level caps
|
||||
@@ -137,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
var timedToken = new TimedToken(token, self, source, duration);
|
||||
var timedToken = new TimedToken(token, self, source, remaining);
|
||||
var index = timedTokens.FindIndex(t => t.Expires >= timedToken.Expires);
|
||||
if (index >= 0)
|
||||
timedTokens.Insert(index, timedToken);
|
||||
|
||||
Reference in New Issue
Block a user