Split off CaptureManagerBotModule

from HackyAI.

Note: This isn't used in any official mod right know,
and known to be bugged on bleed already.
This commit is contained in:
reaperrr
2018-12-20 17:24:14 +01:00
committed by Oliver Brakmann
parent d823d38e8c
commit 6db27b1839
5 changed files with 219 additions and 116 deletions

View File

@@ -74,6 +74,16 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
"MaxBaseRadius",
};
readonly string[] captureManagerFields =
{
"CapturingActorTypes",
"CapturableActorTypes",
"MinimumCaptureDelay",
"MaximumCaptureTargetOptions",
"CheckCaptureTargetsForVisibility",
"CapturableStances",
};
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (!messageShown)
@@ -245,6 +255,21 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
requiresConditionNode.ReplaceValue(oldValue + " || " + conditionString);
}
}
if (captureManagerFields.Any(f => hackyAINode.ChildrenMatching(f).Any()))
{
var node = new MiniYamlNode("CaptureManagerBotModule@" + aiType, "");
node.AddNode(new MiniYamlNode("RequiresCondition", conditionString));
foreach (var field in captureManagerFields)
{
var fieldNode = hackyAINode.LastChildMatching(field);
if (fieldNode != null)
fieldNode.MoveNode(hackyAINode, node);
}
addNodes.Add(node);
}
}
// Only add module if any bot is using/enabling it.