Merge pull request #9838 from Phrohdoh/warhead-colors

Per-warhead WarheadDebugOverlay colors
This commit is contained in:
RoosterDragon
2015-12-10 19:35:00 +00:00
7 changed files with 18 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Warheads
{
var devMode = world.LocalPlayer.PlayerActor.TraitOrDefault<DeveloperMode>();
if (devMode != null && devMode.ShowCombatGeometry)
world.WorldActor.Trait<WarheadDebugOverlay>().AddImpact(pos, Spread);
world.WorldActor.Trait<WarheadDebugOverlay>().AddImpact(pos, Spread, DebugOverlayColor);
}
var range = Spread[0];

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Warheads
{
var devMode = world.LocalPlayer.PlayerActor.TraitOrDefault<DeveloperMode>();
if (devMode != null && devMode.ShowCombatGeometry)
world.WorldActor.Trait<WarheadDebugOverlay>().AddImpact(pos, Range);
world.WorldActor.Trait<WarheadDebugOverlay>().AddImpact(pos, Range, DebugOverlayColor);
}
// This only finds actors where the center is within the search radius,

View File

@@ -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<string> targetTypes)
{
return ValidTargets.Overlaps(targetTypes) && !InvalidTargets.Overlaps(targetTypes);

View File

@@ -581,6 +581,7 @@ Heal:
Falloff: 100, 100, 0
Damage: -200
ValidTargets: Infantry
DebugOverlayColor: 00FF00
WormJaw:
ReloadDelay: 10

View File

@@ -199,6 +199,7 @@ Heal:
Spread: 213
Damage: -50
ValidTargets: Infantry
DebugOverlayColor: 00FF00
Repair:
ReloadDelay: 80
@@ -211,6 +212,7 @@ Repair:
Spread: 213
Damage: -20
ValidTargets: Repair
DebugOverlayColor: 00FF00
Crush:
Warhead@1Dam: SpreadDamage

View File

@@ -6,6 +6,7 @@ Heal:
Projectile: Bullet
Speed: 1c682
Warhead@1Dam: SpreadDamage
DebugOverlayColor: 00FF00
Spread: 213
Damage: -50
ValidTargets: Infantry
@@ -18,6 +19,7 @@ Repair:
Projectile: Bullet
Speed: 1c682
Warhead@1Dam: SpreadDamage
DebugOverlayColor: 00FF00
Spread: 213
Damage: -50
ValidTargets: Repair