Upgrade rule for Health.Shape to HitShape.Type

This commit is contained in:
reaperrr
2017-05-21 14:12:34 +02:00
parent 43b55ae333
commit 7f81de2f8a
15 changed files with 119 additions and 44 deletions

View File

@@ -679,6 +679,28 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
// Added HitShape trait
if (engineVersion < 20170531)
{
var hitShapeNode = new MiniYamlNode("HitShape", "");
// Moved and renamed Health.Shape to HitShape.Type
var health = node.Value.Nodes.FirstOrDefault(n => n.Key == "Health");
if (health != null)
{
var shape = health.Value.Nodes.FirstOrDefault(n => n.Key == "Shape");
if (shape != null)
{
RenameNodeKey(shape, "Type");
hitShapeNode.Value.Nodes.Add(shape);
node.Value.Nodes.Add(hitShapeNode);
health.Value.Nodes.Remove(shape);
}
else
node.Value.Nodes.Add(hitShapeNode);
}
}
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
}