PluggableInfo.Requirements entry overrides in-use check now to allow swapping.
This commit is contained in:
@@ -81,14 +81,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public bool AcceptsPlug(Actor self, string type)
|
public bool AcceptsPlug(Actor self, string type)
|
||||||
{
|
{
|
||||||
if (active != null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!Info.Conditions.ContainsKey(type))
|
if (!Info.Conditions.ContainsKey(type))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Info.Requirements.ContainsKey(type))
|
if (!Info.Requirements.ContainsKey(type))
|
||||||
return true;
|
return active == null;
|
||||||
|
|
||||||
return plugTypesAvailability[type];
|
return plugTypesAvailability[type];
|
||||||
}
|
}
|
||||||
@@ -99,6 +96,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!Info.Conditions.TryGetValue(type, out condition))
|
if (!Info.Conditions.TryGetValue(type, out condition))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (conditionToken != ConditionManager.InvalidConditionToken)
|
||||||
|
conditionManager.RevokeCondition(self, conditionToken);
|
||||||
|
|
||||||
conditionToken = conditionManager.GrantCondition(self, condition);
|
conditionToken = conditionManager.GrantCondition(self, condition);
|
||||||
active = type;
|
active = type;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user