From 7076dfaa4dad2727a57125c4051f0b8e29567705 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 27 Dec 2015 23:32:40 +0100 Subject: [PATCH] HitShape Upgrade Rules Radius is now a sub-property of Shape.Circle. --- .../UtilityCommands/UpgradeRules.cs | 19 +++++++++++++++++++ mods/cnc/rules/defaults.yaml | 9 ++++++--- mods/d2k/rules/defaults.yaml | 3 ++- mods/ra/rules/defaults.yaml | 3 ++- mods/ra/rules/infantry.yaml | 3 ++- mods/ts/rules/civilian-infantry.yaml | 3 ++- mods/ts/rules/defaults.yaml | 6 ++++-- 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 68a1d504ea..e7ccf570e3 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -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("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); } } diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index e31ef10108..1b2375ccc2 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -163,7 +163,8 @@ Inherits@2: ^GainsExperience Inherits@3: ^SpriteActor Health: - Radius: 128 + Shape: Circle + Radius: 128 Armor: Type: None RevealsShroud: @@ -286,8 +287,9 @@ Inherits@1: ^ExistsInWorld Inherits@2: ^SpriteActor Health: - Radius: 128 HP: 1000 + Shape: Circle + Radius: 128 Armor: Type: Wood Buildable: @@ -339,8 +341,9 @@ Inherits@1: ^ExistsInWorld Inherits@2: ^SpriteActor Health: - Radius: 427 HP: 300 + Shape: Circle + Radius: 427 Armor: Type: Wood RevealsShroud: diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 93b3974a14..ba26ddd6c3 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -160,7 +160,8 @@ Inherits@2: ^GainsExperience Inherits@3: ^SpriteActor Health: - Radius: 96 + Shape: Circle + Radius: 96 Armor: Type: none RevealsShroud: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 6a6da42e55..2e9849ad09 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -165,8 +165,9 @@ Inherits@3: ^SpriteActor DrawLineToTarget: Health: - Radius: 128 HP: 25 + Shape: Circle + Radius: 128 Armor: Type: None RevealsShroud: diff --git a/mods/ra/rules/infantry.yaml b/mods/ra/rules/infantry.yaml index 59e1d52dd2..946a6f270c 100644 --- a/mods/ra/rules/infantry.yaml +++ b/mods/ra/rules/infantry.yaml @@ -591,7 +591,8 @@ Ant: VisualBounds: 30,30,0,-2 Health: HP: 750 - Radius: 469 + Shape: Circle + Radius: 469 Mobile: Speed: 99 ROT: 12 diff --git a/mods/ts/rules/civilian-infantry.yaml b/mods/ts/rules/civilian-infantry.yaml index 6e2d74cfb9..c6f4b425e1 100644 --- a/mods/ts/rules/civilian-infantry.yaml +++ b/mods/ts/rules/civilian-infantry.yaml @@ -211,8 +211,9 @@ DOGGIE: Tooltip: Name: Tiberian Fiend Health: - Radius: 213 HP: 250 + Shape: Circle + Radius: 213 PoisonedByTiberium: Weapon: TiberiumHeal Valued: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 20c1d2f629..9161b90d82 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -231,8 +231,9 @@ Inherits@3: ^SpriteActor DrawLineToTarget: Health: - Radius: 128 HP: 50 + Shape: Circle + Radius: 128 Armor: Type: None Valued: @@ -518,7 +519,8 @@ Inherits@2: ^SpriteActor DrawLineToTarget: Health: - Radius: 256 + Shape: Circle + Radius: 256 Armor: Type: Light Mobile: