Move SupportPowerDecisions to a single parent node.

This is required before we can force all trait
properties to match a TraitInfo-defined field.
This commit is contained in:
Paul Chote
2018-06-14 15:37:15 +00:00
committed by reaperrr
parent f82674cfef
commit cce9b06a40
8 changed files with 559 additions and 490 deletions

View File

@@ -195,7 +195,7 @@ namespace OpenRA.Mods.Common.AI
// TODO Update OpenRA.Utility/Command.cs#L300 to first handle lists and also read nested ones
[Desc("Tells the AI how to use its support powers.")]
[FieldLoader.LoadUsing("LoadDecisions")]
public readonly List<SupportPowerDecision> PowerDecisions = new List<SupportPowerDecision>();
public readonly List<SupportPowerDecision> SupportPowerDecisions = new List<SupportPowerDecision>();
[Desc("Actor types that can capture other actors (via `Captures` or `ExternalCaptures`).",
"Leave this empty to disable capturing.")]
@@ -233,8 +233,9 @@ namespace OpenRA.Mods.Common.AI
static object LoadDecisions(MiniYaml yaml)
{
var ret = new List<SupportPowerDecision>();
foreach (var d in yaml.Nodes)
if (d.Key.Split('@')[0] == "SupportPowerDecision")
var decisions = yaml.Nodes.FirstOrDefault(n => n.Key == "SupportPowerDecisions");
if (decisions != null)
foreach (var d in decisions.Value.Nodes)
ret.Add(new SupportPowerDecision(d.Value));
return ret;