diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 310d07f40d..376d6d536f 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -624,6 +624,29 @@ namespace OpenRA.Mods.Common.UtilityCommands node.Key = "TrackTarget"; } + // Refactor GravityBomb Speed WDist to Velocity WVec and Acceleration from vertical WDist to vector + if (engineVersion < 20170329) + { + var projectile = node.Value.Nodes.FirstOrDefault(n => n.Key == "Projectile"); + if (projectile != null && projectile.Value.Value == "GravityBomb") + { + var speedNode = projectile.Value.Nodes.FirstOrDefault(x => x.Key == "Speed"); + if (speedNode != null) + { + var oldWDistSpeed = FieldLoader.GetValue("Speed", speedNode.Value.Value); + speedNode.Value.Value = "0, 0, -" + oldWDistSpeed; + speedNode.Key = "Velocity"; + } + + var accelNode = projectile.Value.Nodes.FirstOrDefault(x => x.Key == "Acceleration"); + if (accelNode != null) + { + var oldWDistAccel = FieldLoader.GetValue("Acceleration", accelNode.Value.Value); + accelNode.Value.Value = "0, 0, -" + oldWDistAccel; + } + } + } + UpgradeWeaponRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); } }