diff --git a/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs b/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs index ab1204c021..e0c5d38b4e 100644 --- a/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs @@ -29,6 +29,7 @@ namespace OpenRA.Mods.Common.Traits { public readonly WPos CenterPosition; public readonly WDist[] Range; + public readonly Color Color; public int Time; public WDist OuterRange @@ -36,10 +37,11 @@ namespace OpenRA.Mods.Common.Traits get { return Range[Range.Length - 1]; } } - public WHImpact(WPos pos, WDist[] range, int time) + public WHImpact(WPos pos, WDist[] range, int time, Color color) { CenterPosition = pos; Range = range; + Color = color; Time = time; } } @@ -52,9 +54,9 @@ namespace OpenRA.Mods.Common.Traits this.info = info; } - public void AddImpact(WPos pos, WDist[] range) + public void AddImpact(WPos pos, WDist[] range, Color color) { - impacts.Add(new WHImpact(pos, range, info.DisplayDuration)); + impacts.Add(new WHImpact(pos, range, info.DisplayDuration, color)); } public void RenderAfterWorld(WorldRenderer wr, Actor self) @@ -64,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits var alpha = 255.0f * i.Time / info.DisplayDuration; var rangeStep = alpha / i.Range.Length; - wr.DrawRangeCircle(i.CenterPosition, i.OuterRange, Color.FromArgb((int)alpha, Color.Red)); + wr.DrawRangeCircle(i.CenterPosition, i.OuterRange, Color.FromArgb((int)alpha, i.Color)); foreach (var r in i.Range) { @@ -72,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits var br = wr.ScreenPosition(i.CenterPosition + new WVec(r.Length, r.Length, 0)); var rect = RectangleF.FromLTRB(tl.X, tl.Y, br.X, br.Y); - Game.Renderer.WorldLineRenderer.FillEllipse(rect, Color.FromArgb((int)alpha, Color.Red)); + Game.Renderer.WorldLineRenderer.FillEllipse(rect, Color.FromArgb((int)alpha, i.Color)); alpha -= rangeStep; } diff --git a/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs index 9086227f3e..91124a08c3 100644 --- a/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Warheads { var devMode = world.LocalPlayer.PlayerActor.TraitOrDefault(); if (devMode != null && devMode.ShowCombatGeometry) - world.WorldActor.Trait().AddImpact(pos, Spread); + world.WorldActor.Trait().AddImpact(pos, Spread, DebugOverlayColor); } var range = Spread[0]; diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 60d3f985d7..9330404895 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Warheads { var devMode = world.LocalPlayer.PlayerActor.TraitOrDefault(); if (devMode != null && devMode.ShowCombatGeometry) - world.WorldActor.Trait().AddImpact(pos, Range); + world.WorldActor.Trait().AddImpact(pos, Range, DebugOverlayColor); } // This only finds actors where the center is within the search radius, diff --git a/OpenRA.Mods.Common/Warheads/Warhead.cs b/OpenRA.Mods.Common/Warheads/Warhead.cs index 8073a75a13..3856771a41 100644 --- a/OpenRA.Mods.Common/Warheads/Warhead.cs +++ b/OpenRA.Mods.Common/Warheads/Warhead.cs @@ -9,6 +9,7 @@ #endregion using System.Collections.Generic; +using System.Drawing; using System.Linq; using OpenRA.Traits; @@ -33,6 +34,9 @@ namespace OpenRA.Mods.Common.Warheads public readonly int Delay = 0; int IWarhead.Delay { get { return Delay; } } + [Desc("The color used for this warhead's visualization in the world's `WarheadDebugOverlay` trait.")] + public readonly Color DebugOverlayColor = Color.Red; + public bool IsValidTarget(IEnumerable targetTypes) { return ValidTargets.Overlaps(targetTypes) && !InvalidTargets.Overlaps(targetTypes);