diff --git a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs index fc6a4a5081..e8f4d399ae 100644 --- a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs @@ -28,9 +28,6 @@ namespace OpenRA.Mods.Common.Traits public class CombatDebugOverlay : IRenderAnnotations, INotifyDamage, INotifyCreated { - static readonly WVec TargetPosHLine = new WVec(0, 128, 0); - static readonly WVec TargetPosVLine = new WVec(128, 0, 0); - readonly DebugVisualizations debugVis; readonly IHealthInfo healthInfo; readonly Lazy coords; @@ -70,14 +67,12 @@ namespace OpenRA.Mods.Common.Traits } foreach (var s in shapes) + { + foreach (var a in s.RenderDebugAnnotations(self, wr)) + yield return a; + foreach (var r in s.RenderDebugOverlay(self, wr)) yield return r; - - var positions = Target.FromActor(self).Positions; - foreach (var p in positions) - { - yield return new LineAnnotationRenderable(p - TargetPosHLine, p + TargetPosHLine, 1, Color.Lime); - yield return new LineAnnotationRenderable(p - TargetPosVLine, p + TargetPosVLine, 1, Color.Lime); } foreach (var attack in self.TraitsImplementing().Where(x => !x.IsTraitDisabled)) diff --git a/OpenRA.Mods.Common/Traits/HitShape.cs b/OpenRA.Mods.Common/Traits/HitShape.cs index 48047c45cf..fff76d530b 100644 --- a/OpenRA.Mods.Common/Traits/HitShape.cs +++ b/OpenRA.Mods.Common/Traits/HitShape.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Graphics; +using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.HitShapes; using OpenRA.Primitives; using OpenRA.Traits; @@ -131,6 +132,18 @@ namespace OpenRA.Mods.Common.Traits return Info.Type.DistanceFromEdge(pos, origin, orientation); } + public IEnumerable RenderDebugAnnotations(Actor self, WorldRenderer wr) + { + var targetPosHLine = new WVec(0, 128, 0); + var targetPosVLine = new WVec(128, 0, 0); + var targetPosColor = IsTraitDisabled ? Color.Gainsboro : Color.Lime; + foreach (var p in TargetablePositions(self)) + { + yield return new LineAnnotationRenderable(p - targetPosHLine, p + targetPosHLine, 1, targetPosColor); + yield return new LineAnnotationRenderable(p - targetPosVLine, p + targetPosVLine, 1, targetPosColor); + } + } + public IEnumerable RenderDebugOverlay(Actor self, WorldRenderer wr) { var origin = turret != null ? self.CenterPosition + turret.Position(self) : self.CenterPosition;