From a5aff66848b69efcf85bba7a1bfc80a4fb6aec75 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Thu, 5 Nov 2015 20:07:32 +0100 Subject: [PATCH 1/3] Polish the documentation in Explodes.cs --- OpenRA.Mods.Common/Traits/Explodes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Explodes.cs b/OpenRA.Mods.Common/Traits/Explodes.cs index 3bc55dcd95..b2dfbf15db 100644 --- a/OpenRA.Mods.Common/Traits/Explodes.cs +++ b/OpenRA.Mods.Common/Traits/Explodes.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Health level at which actor will explode.")] public readonly int DamageThreshold = 0; - [Desc("DeathType(s) to apply upon explosion.")] + [Desc("DeathType(s) that trigger the explosion. Leave empty to always trigger an explosion.")] public readonly HashSet DeathType = new HashSet(); public WeaponInfo WeaponInfo { get; private set; } From 4a4608e1f3f8cb94479ea12a2f0433739e7f6e32 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Thu, 5 Nov 2015 20:13:40 +0100 Subject: [PATCH 2/3] Rename DeathType to DeathTypes of Explodes --- OpenRA.Mods.Common/Traits/Explodes.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Explodes.cs b/OpenRA.Mods.Common/Traits/Explodes.cs index b2dfbf15db..2c423c6adf 100644 --- a/OpenRA.Mods.Common/Traits/Explodes.cs +++ b/OpenRA.Mods.Common/Traits/Explodes.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int DamageThreshold = 0; [Desc("DeathType(s) that trigger the explosion. Leave empty to always trigger an explosion.")] - public readonly HashSet DeathType = new HashSet(); + public readonly HashSet DeathTypes = new HashSet(); public WeaponInfo WeaponInfo { get; private set; } public WeaponInfo EmptyWeaponInfo { get; private set; } @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits return; var warhead = e.Warhead as DamageWarhead; - if (info.DeathType.Count > 0 && warhead != null && !warhead.DamageTypes.Overlaps(info.DeathType)) + if (info.DeathTypes.Count > 0 && warhead != null && !warhead.DamageTypes.Overlaps(info.DeathTypes)) return; var weapon = ChooseWeaponForExplosion(self); From 8c2c9462542a80cbc0e3a2805cb0120918b78a17 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 9 Nov 2015 15:32:57 +0100 Subject: [PATCH 3/3] Add an upgrade rule for the DeathType -> DeathTypes change --- OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index ddb9f9cd0f..a9494682ee 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -2377,6 +2377,17 @@ namespace OpenRA.Mods.Common.UtilityCommands node.Key = "ParticleSize"; } + // DeathType on Explodes was renamed to DeathTypes + if (engineVersion < 20151110) + { + if (node.Key == "Explodes") + { + var dt = node.Value.Nodes.FirstOrDefault(n => n.Key == "DeathType"); + if (dt != null) + dt.Key = "DeathTypes"; + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } }