Convert AISupportPowerManager to module

This commit is contained in:
reaperrr
2018-11-04 02:59:16 +01:00
committed by Oliver Brakmann
parent c195699476
commit 451a38338b
8 changed files with 78 additions and 397 deletions

View File

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