From a7b5800d6fe7d5ce449d25621975ffec79b54594 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 27 Dec 2015 18:54:39 +0100 Subject: [PATCH] Make AreaBeam and LaserZap Z sorting customizable --- OpenRA.Mods.Common/Effects/AreaBeam.cs | 5 ++++- OpenRA.Mods.Common/Effects/LaserZap.cs | 5 ++++- mods/cnc/weapons/other.yaml | 1 + mods/ts/weapons/energyweapons.yaml | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Effects/AreaBeam.cs b/OpenRA.Mods.Common/Effects/AreaBeam.cs index ec0ddfcadb..d7bca93818 100644 --- a/OpenRA.Mods.Common/Effects/AreaBeam.cs +++ b/OpenRA.Mods.Common/Effects/AreaBeam.cs @@ -59,6 +59,9 @@ namespace OpenRA.Mods.Common.Effects [Desc("Should the beam be visuall rendered? False = Beam is invisible.")] public readonly bool RenderBeam = true; + [Desc("Equivalent to sequence ZOffset. Controls Z sorting.")] + public readonly int ZOffset = 0; + [Desc("Color of the beam.")] public readonly Color Color = Color.Red; @@ -193,7 +196,7 @@ namespace OpenRA.Mods.Common.Effects { if (!IsBeamComplete && info.RenderBeam && !(wr.World.FogObscures(tailPos) && wr.World.FogObscures(headPos))) { - var beamRender = new BeamRenderable(headPos, 0, tailPos - headPos, info.Shape, info.Width, color); + var beamRender = new BeamRenderable(headPos, info.ZOffset, tailPos - headPos, info.Shape, info.Width, color); return new[] { (IRenderable)beamRender }; } diff --git a/OpenRA.Mods.Common/Effects/LaserZap.cs b/OpenRA.Mods.Common/Effects/LaserZap.cs index 11d949be35..7b74912256 100644 --- a/OpenRA.Mods.Common/Effects/LaserZap.cs +++ b/OpenRA.Mods.Common/Effects/LaserZap.cs @@ -27,6 +27,9 @@ namespace OpenRA.Mods.Common.Effects [Desc("The shape of the beam. Accepts values Cylindrical or Flat.")] public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical; + [Desc("Equivalent to sequence ZOffset. Controls Z sorting.")] + public readonly int ZOffset = 0; + public readonly int BeamDuration = 10; public readonly bool UsePlayerColor = false; @@ -102,7 +105,7 @@ namespace OpenRA.Mods.Common.Effects if (ticks < info.BeamDuration) { var rc = Color.FromArgb((info.BeamDuration - ticks) * 255 / info.BeamDuration, color); - yield return new BeamRenderable(args.Source, 0, target - args.Source, info.Shape, info.Width, rc); + yield return new BeamRenderable(args.Source, info.ZOffset, target - args.Source, info.Shape, info.Width, rc); } if (hitanim != null) diff --git a/mods/cnc/weapons/other.yaml b/mods/cnc/weapons/other.yaml index 4476e9a170..f41ea6ec88 100644 --- a/mods/cnc/weapons/other.yaml +++ b/mods/cnc/weapons/other.yaml @@ -125,6 +125,7 @@ Laser: Projectile: LaserZap Width: 85 HitAnim: laserfire + ZOffset: 2047 Warhead@1Dam: SpreadDamage Spread: 42 Damage: 360 diff --git a/mods/ts/weapons/energyweapons.yaml b/mods/ts/weapons/energyweapons.yaml index dfba483513..75916ae61a 100644 --- a/mods/ts/weapons/energyweapons.yaml +++ b/mods/ts/weapons/energyweapons.yaml @@ -75,6 +75,7 @@ SonicZap: DamageInterval: 5 # Roughly 18 impacts. Width: 0c384 Shape: Flat + ZOffset: 2047 BeyondTargetRange: 0c256 Blockable: true Color: 00FFFFC8 @@ -176,6 +177,7 @@ ObeliskLaserFire: Report: OBELRAY1.AUD Projectile: LaserZap Width: 170 + ZOffset: 2047 Warhead@1Dam: SpreadDamage Spread: 42 Damage: 250 @@ -188,6 +190,7 @@ TurretLaserFire: Projectile: LaserZap Width: 85 BeamDuration: 5 + ZOffset: 2047 Warhead@1Dam: SpreadDamage Spread: 42 Damage: 30