Add ContrailEndColor and Contrail transparency control

This commit is contained in:
Gustas
2022-08-24 16:25:07 +03:00
committed by Matthias Mailänder
parent d8f45714a7
commit 1809817b3f
9 changed files with 143 additions and 40 deletions

View File

@@ -103,8 +103,6 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("When set, display a line behind the actor. Length is measured in ticks after appearing.")]
public readonly int ContrailLength = 0;
public readonly Color ContrailColor = Color.White;
public readonly bool ContrailUsePlayerColor = false;
[Desc("Time (in ticks) after which the line should appear. Controls the distance to the actor.")]
public readonly int ContrailDelay = 1;
@@ -115,6 +113,24 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Thickness of the emitted line.")]
public readonly WDist ContrailWidth = new WDist(64);
[Desc("RGB color at the contrail start.")]
public readonly Color ContrailStartColor = Color.White;
[Desc("Use player remap color instead of a custom color at the contrail the start.")]
public readonly bool ContrailStartColorUsePlayerColor = false;
[Desc("The alpha value [from 0 to 255] of color at the contrail the start.")]
public readonly int ContrailStartColorAlpha = 255;
[Desc("RGB color at the contrail end. Set to start color if undefined")]
public readonly Color? ContrailEndColor;
[Desc("Use player remap color instead of a custom color at the contrail end.")]
public readonly bool ContrailEndColorUsePlayerColor = false;
[Desc("The alpha value [from 0 to 255] of color at the contrail end.")]
public readonly int ContrailEndColorAlpha = 0;
public IProjectile Create(ProjectileArgs args) { return new Bullet(this, args); }
}
@@ -180,8 +196,9 @@ namespace OpenRA.Mods.Common.Projectiles
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
contrail = new ContrailRenderable(world, color, info.ContrailWidth, info.ContrailLength, info.ContrailDelay, info.ContrailZOffset);
var startcolor = info.ContrailStartColorUsePlayerColor ? Color.FromArgb(info.ContrailStartColorAlpha, args.SourceActor.Owner.Color) : Color.FromArgb(info.ContrailStartColorAlpha, info.ContrailStartColor);
var endcolor = info.ContrailEndColorUsePlayerColor ? Color.FromArgb(info.ContrailEndColorAlpha, args.SourceActor.Owner.Color) : Color.FromArgb(info.ContrailEndColorAlpha, info.ContrailEndColor ?? info.ContrailStartColor);
contrail = new ContrailRenderable(world, startcolor, endcolor, info.ContrailWidth, info.ContrailLength, info.ContrailDelay, info.ContrailZOffset);
}
trailPalette = info.TrailPalette;

View File

@@ -142,10 +142,23 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Thickness of the emitted line.")]
public readonly WDist ContrailWidth = new WDist(64);
public readonly Color ContrailColor = Color.White;
[Desc("RGB color at the contrail start.")]
public readonly Color ContrailStartColor = Color.White;
public readonly bool ContrailUsePlayerColor = false;
[Desc("Use player remap color instead of a custom color at the contrail the start.")]
public readonly bool ContrailStartColorUsePlayerColor = false;
[Desc("The alpha value [from 0 to 255] of color at the contrail the start.")]
public readonly int ContrailStartColorAlpha = 255;
[Desc("RGB color at the contrail end. Set to start color if undefined")]
public readonly Color? ContrailEndColor;
[Desc("Use player remap color instead of a custom color at the contrail end.")]
public readonly bool ContrailEndColorUsePlayerColor = false;
[Desc("The alpha value [from 0 to 255] of color at the contrail end.")]
public readonly int ContrailEndColorAlpha = 0;
[Desc("Should missile targeting be thrown off by nearby actors with JamsMissiles.")]
public readonly bool Jammable = true;
@@ -269,8 +282,9 @@ namespace OpenRA.Mods.Common.Projectiles
if (info.ContrailLength > 0)
{
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
contrail = new ContrailRenderable(world, color, info.ContrailWidth, info.ContrailLength, info.ContrailDelay, info.ContrailZOffset);
var startcolor = info.ContrailStartColorUsePlayerColor ? Color.FromArgb(info.ContrailStartColorAlpha, args.SourceActor.Owner.Color) : Color.FromArgb(info.ContrailStartColorAlpha, info.ContrailStartColor);
var endcolor = info.ContrailEndColorUsePlayerColor ? Color.FromArgb(info.ContrailEndColorAlpha, args.SourceActor.Owner.Color) : Color.FromArgb(info.ContrailEndColorAlpha, info.ContrailEndColor ?? info.ContrailStartColor);
contrail = new ContrailRenderable(world, startcolor, endcolor, info.ContrailWidth, info.ContrailLength, info.ContrailDelay, info.ContrailZOffset);
}
trailPalette = info.TrailPalette;