PluggableInfo.Requirements entry overrides in-use check now to allow swapping.

This commit is contained in:
atlimit8
2017-02-11 11:19:17 -06:00
parent daf4eb812c
commit 08a71795d1

View File

@@ -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;
} }