From 547e64724fccb15d38635e33d59ed6e05ac2cbaa Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 26 May 2013 16:47:23 +0200 Subject: [PATCH] Changes name of LaserZap Explosion trait to HitAnim. Additionally sets default HitAnim to null instead of "laserfire", to avoid crashes when neither a custom HitAnim nor laserfire anim are present. --- OpenRA.Mods.RA/Effects/LaserZap.cs | 20 ++++++++++---------- mods/cnc/weapons.yaml | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/OpenRA.Mods.RA/Effects/LaserZap.cs b/OpenRA.Mods.RA/Effects/LaserZap.cs index f85f711f8f..c5f5ca4fb1 100755 --- a/OpenRA.Mods.RA/Effects/LaserZap.cs +++ b/OpenRA.Mods.RA/Effects/LaserZap.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects public readonly int BeamDuration = 10; public readonly bool UsePlayerColor = false; public readonly Color Color = Color.Red; - public readonly string Explosion = "laserfire"; + public readonly string HitAnim = null; public IEffect Create(ProjectileArgs args) { @@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Effects int ticks = 0; Color color; bool doneDamage; - Animation explosion; + Animation hitanim; public LaserZap(ProjectileArgs args, LaserZapInfo info, Color color) { @@ -49,8 +49,8 @@ namespace OpenRA.Mods.RA.Effects this.info = info; this.color = color; - if (info.Explosion != null) - this.explosion = new Animation(info.Explosion); + if (info.HitAnim != null) + this.hitanim = new Animation(info.HitAnim); } public void Tick(World world) @@ -61,16 +61,16 @@ namespace OpenRA.Mods.RA.Effects if (!doneDamage) { - if (explosion != null) - explosion.PlayThen("idle", + if (hitanim != null) + hitanim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this))); Combat.DoImpacts(args); doneDamage = true; } ++ticks; - if (explosion != null) - explosion.Tick(); + if (hitanim != null) + hitanim.Tick(); else if (ticks >= info.BeamDuration) world.AddFrameEndTask(w => w.Remove(this)); @@ -78,8 +78,8 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render(WorldRenderer wr) { - if (explosion != null) - yield return new SpriteRenderable(explosion.Image, args.dest.ToFloat2(), + if (hitanim != null) + yield return new SpriteRenderable(hitanim.Image, args.dest.ToFloat2(), wr.Palette("effect"), (int)args.dest.Y); if (ticks >= info.BeamDuration) diff --git a/mods/cnc/weapons.yaml b/mods/cnc/weapons.yaml index caefc3be03..2e5d979689 100644 --- a/mods/cnc/weapons.yaml +++ b/mods/cnc/weapons.yaml @@ -761,6 +761,7 @@ Laser: Report: OBELRAY1 Projectile: LaserZap BeamWidth: 2 + HitAnim: laserfire Warhead: Spread: 1 Versus: