HitShape Upgrade Rules

Radius is now a sub-property of Shape.Circle.
This commit is contained in:
reaperrr
2015-12-27 23:32:40 +01:00
committed by Huw Pascoe
parent b427190ab4
commit 7076dfaa4d
7 changed files with 37 additions and 9 deletions

View File

@@ -2788,6 +2788,25 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
// Refactored Health.Radius to HitShapes
if (engineVersion < 20151227)
{
if (node.Key.StartsWith("Health"))
{
var radius = node.Value.Nodes.FirstOrDefault(x => x.Key == "Radius");
if (radius != null)
{
var radiusValue = FieldLoader.GetValue<string>("Radius", radius.Value.Value);
node.Value.Nodes.Add(new MiniYamlNode("Shape", "Circle"));
var shape = node.Value.Nodes.First(x => x.Key == "Shape");
shape.Value.Nodes.Add(new MiniYamlNode("Radius", radiusValue));
node.Value.Nodes.Remove(radius);
}
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}