Make all range circles fully configurable.

This commit is contained in:
Matthias Mailänder
2020-10-17 18:33:16 +02:00
committed by Paul Chote
parent 214aa64ce3
commit 14fc0254c6
12 changed files with 205 additions and 44 deletions

View File

@@ -56,6 +56,18 @@ namespace OpenRA.Mods.Cnc.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Range circle color.")]
public readonly Color CircleColor = Color.FromArgb(128, Color.LawnGreen);
[Desc("Range circle line width.")]
public readonly float CircleWidth = 1;
[Desc("Range circle border color.")]
public readonly Color CircleBorderColor = Color.FromArgb(96, Color.Black);
[Desc("Range circle border width.")]
public readonly float CircleBorderWidth = 3;
public override object Create(ActorInitializer init) { return new PortableChrono(init.Self, this); }
}
@@ -232,8 +244,10 @@ namespace OpenRA.Mods.Cnc.Traits
self.CenterPosition,
WDist.FromCells(self.Trait<PortableChrono>().Info.MaxDistance),
0,
Color.FromArgb(128, Color.LawnGreen),
Color.FromArgb(96, Color.Black));
info.CircleColor,
info.CircleWidth,
info.CircleBorderColor,
info.CircleBorderWidth);
}
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)

View File

@@ -22,6 +22,18 @@ namespace OpenRA.Mods.Cnc.Traits
{
class AttackOrderPowerInfo : SupportPowerInfo, Requires<AttackBaseInfo>
{
[Desc("Range circle color.")]
public readonly Color CircleColor = Color.Red;
[Desc("Range circle line width.")]
public readonly float CircleWidth = 1;
[Desc("Range circle border color.")]
public readonly Color CircleBorderColor = Color.FromArgb(96, Color.Black);
[Desc("Range circle border width.")]
public readonly float CircleBorderWidth = 3;
public override object Create(ActorInitializer init) { return new AttackOrderPower(init.Self, this); }
}
@@ -118,21 +130,26 @@ namespace OpenRA.Mods.Cnc.Traits
protected override IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World world)
{
var info = instance.Info as AttackOrderPowerInfo;
foreach (var a in instance.Instances.Where(i => !i.IsTraitPaused))
{
yield return new RangeCircleAnnotationRenderable(
a.Self.CenterPosition,
attack.GetMinimumRange(),
0,
Color.Red,
Color.FromArgb(96, Color.Black));
info.CircleColor,
info.CircleWidth,
info.CircleBorderColor,
info.CircleBorderWidth);
yield return new RangeCircleAnnotationRenderable(
a.Self.CenterPosition,
attack.GetMaximumRange(),
0,
Color.Red,
Color.FromArgb(96, Color.Black));
info.CircleColor,
info.CircleWidth,
info.CircleBorderColor,
info.CircleBorderWidth);
}
}