Introduced VisualBounds on SelectionDecorations

To allow visual selection boxes to be independent from Selectable.Bounds.
This commit is contained in:
reaperrr
2015-04-07 22:32:38 +02:00
parent f72a14faea
commit d6fb05ce68
6 changed files with 51 additions and 10 deletions

View File

@@ -1152,6 +1152,29 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
if (engineVersion < 20150603)
{
if (depth == 0 && node.Value.Nodes.Exists(n => n.Key == "Selectable"))
{
var selectable = node.Value.Nodes.FirstOrDefault(n => n.Key == "Selectable");
var selDecor = node.Value.Nodes.FirstOrDefault(n => n.Key == "SelectionDecorations");
var selectableNodes = selectable.Value.Nodes;
var bounds = selectableNodes.FirstOrDefault(n => n.Key == "Bounds");
if (bounds != null)
{
var visualBounds = FieldLoader.GetValue<string>("Bounds", bounds.Value.Value);
if (selDecor != null)
selDecor.Value.Nodes.Add(new MiniYamlNode("VisualBounds", visualBounds.ToString()));
else
node.Value.Nodes.Add(new MiniYamlNode("SelectionDecorations", "", new List<MiniYamlNode>
{
new MiniYamlNode("VisualBounds", visualBounds),
}));
}
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}