From 92c05912e191a4b5c951ef747ebceff9b5c1ea8d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 25 Oct 2015 11:55:47 +0100 Subject: [PATCH 1/3] Remove negligible stages from default warhead Falloff - reduces situations where infantry goes prone even though the impact was rather far away and damage absolutely negligible - saves a little bit of performance by reducing the total area of effect, resulting in lower average number of calls to Health.InflictDamage at a given Spread value --- OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 2ea493e7db..925a85aaee 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly WDist TargetExtraSearchRadius = new WDist(2048); [Desc("Damage percentage at each range step")] - public readonly int[] Falloff = { 100, 37, 14, 5, 2, 1, 0 }; + public readonly int[] Falloff = { 100, 37, 14, 5, 0 }; [Desc("Ranges at which each Falloff step is defined. Overrides Spread.")] public WDist[] Range = null; From fa29b1696777e8ca18d66a589bbcae10e512825f Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 25 Oct 2015 11:58:12 +0100 Subject: [PATCH 2/3] Skip DoImpact if actor has no Health trait --- OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 925a85aaee..511d10f8a8 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -65,13 +65,13 @@ namespace OpenRA.Mods.Common.Warheads if (!IsValidAgainst(victim, firedBy)) continue; - var localModifiers = damageModifiers; var healthInfo = victim.Info.TraitInfoOrDefault(); - if (healthInfo != null) - { - var distance = Math.Max(0, (victim.CenterPosition - pos).Length - healthInfo.Radius.Length); - localModifiers = localModifiers.Append(GetDamageFalloff(distance)); - } + if (healthInfo == null) + continue; + + var localModifiers = damageModifiers; + var distance = Math.Max(0, (victim.CenterPosition - pos).Length - healthInfo.Radius.Length); + localModifiers = localModifiers.Append(GetDamageFalloff(distance)); DoImpact(victim, firedBy, localModifiers); } From 731875c270435fc2ec33ede05a72f08bb3c3d5fc Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 25 Oct 2015 14:23:37 +0100 Subject: [PATCH 3/3] Reduce default warhead TargetExtraSearchRadius There aren't any actors in any shipping mod where a health radius larger than 1c512 would be feasible, so no need to make the default larger than necessary. --- OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 511d10f8a8..3c93865f7c 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly WDist Spread = new WDist(43); [Desc("Extra search radius beyond maximum spread. Required to ensure damage to actors with large health radius.")] - public readonly WDist TargetExtraSearchRadius = new WDist(2048); + public readonly WDist TargetExtraSearchRadius = new WDist(1536); [Desc("Damage percentage at each range step")] public readonly int[] Falloff = { 100, 37, 14, 5, 0 };