Fix old shape scaling
This commit is contained in:
@@ -640,6 +640,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
if (node.Key == "Offset" && parent.Key.StartsWith("WithHarvestOverlay", StringComparison.Ordinal))
|
if (node.Key == "Offset" && parent.Key.StartsWith("WithHarvestOverlay", StringComparison.Ordinal))
|
||||||
RenameNodeKey(node, "LocalOffset");
|
RenameNodeKey(node, "LocalOffset");
|
||||||
|
|
||||||
|
var gridType = modData.Manifest.Get<MapGrid>().Type;
|
||||||
|
if (gridType == MapGridType.RectangularIsometric)
|
||||||
|
{
|
||||||
if (node.Key == "LocalOffset")
|
if (node.Key == "LocalOffset")
|
||||||
{
|
{
|
||||||
var orig = FieldLoader.GetValue<WVec[]>(node.Key, node.Value.Value);
|
var orig = FieldLoader.GetValue<WVec[]>(node.Key, node.Value.Value);
|
||||||
@@ -649,6 +652,30 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
(int)Math.Round(Math.Sqrt(2) * o.Z))));
|
(int)Math.Round(Math.Sqrt(2) * o.Z))));
|
||||||
node.Value.Value = scaled.JoinWith(", ");
|
node.Value.Value = scaled.JoinWith(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.Key == "Radius" && parent.Key == "Shape")
|
||||||
|
{
|
||||||
|
var orig = FieldLoader.GetValue<WDist>(node.Key, node.Value.Value);
|
||||||
|
var scaled = (int)Math.Round(Math.Sqrt(2) * orig.Length);
|
||||||
|
node.Value.Value = scaled.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.Key == "TopLeft" || node.Key == "BottomRight" || node.Key == "PointA" || node.Key == "PointB")
|
||||||
|
{
|
||||||
|
var orig = FieldLoader.GetValue<int2>(node.Key, node.Value.Value);
|
||||||
|
var scaled = new int2(
|
||||||
|
(int)Math.Round(Math.Sqrt(2) * orig.X),
|
||||||
|
(int)Math.Round(Math.Sqrt(2) * orig.Y));
|
||||||
|
node.Value.Value = scaled.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.Key == "VerticalTopOffset" || node.Key == "VerticalBottomOffset")
|
||||||
|
{
|
||||||
|
var orig = FieldLoader.GetValue<int>(node.Key, node.Value.Value);
|
||||||
|
var scaled = (int)Math.Round(Math.Sqrt(2) * orig);
|
||||||
|
node.Value.Value = scaled.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refactor Rectangle shape RotateToIsometry bool into WAngle LocalYaw
|
// Refactor Rectangle shape RotateToIsometry bool into WAngle LocalYaw
|
||||||
|
|||||||
Reference in New Issue
Block a user