Convert AISupportPowerManager to module
This commit is contained in:
committed by
Oliver Brakmann
parent
c195699476
commit
451a38338b
@@ -33,6 +33,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
"HarvesterEnemyAvoidanceRadius", "AssignRolesInterval"
|
||||
};
|
||||
|
||||
readonly string[] supportPowerFields =
|
||||
{
|
||||
"SupportPowerDecisions"
|
||||
};
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
var message = "You may want to check your AI yamls for possible redundant module entries.\n" +
|
||||
@@ -118,6 +123,21 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
requiresConditionNode.ReplaceValue(oldValue + " || " + conditionString);
|
||||
}
|
||||
}
|
||||
|
||||
if (supportPowerFields.Any(f => hackyAINode.ChildrenMatching(f).Any()))
|
||||
{
|
||||
var spNode = new MiniYamlNode("SupportPowerBotModule@" + aiType, "");
|
||||
spNode.AddNode(requiresCondition);
|
||||
|
||||
foreach (var spf in supportPowerFields)
|
||||
{
|
||||
var fieldNode = hackyAINode.LastChildMatching(spf);
|
||||
if (fieldNode != null)
|
||||
fieldNode.MoveAndRenameNode(hackyAINode, spNode, "Decisions");
|
||||
}
|
||||
|
||||
addNodes.Add(spNode);
|
||||
}
|
||||
}
|
||||
|
||||
addNodes.Add(defaultHarvNode);
|
||||
|
||||
Reference in New Issue
Block a user