From 2378b427fe995433ca8727387a7799806abe9c2f Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 6 Mar 2016 15:30:52 +0100 Subject: [PATCH 1/2] Fix GravityBomb crashing when Image is null --- OpenRA.Mods.Common/Effects/GravityBomb.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Effects/GravityBomb.cs b/OpenRA.Mods.Common/Effects/GravityBomb.cs index 0ff464fdb3..504d73f400 100644 --- a/OpenRA.Mods.Common/Effects/GravityBomb.cs +++ b/OpenRA.Mods.Common/Effects/GravityBomb.cs @@ -56,10 +56,10 @@ namespace OpenRA.Mods.Common.Effects velocity = new WVec(WDist.Zero, WDist.Zero, -info.Velocity); acceleration = new WVec(WDist.Zero, WDist.Zero, info.Acceleration); - anim = new Animation(args.SourceActor.World, info.Image); - if (!string.IsNullOrEmpty(info.Image)) { + anim = new Animation(args.SourceActor.World, info.Image); + if (!string.IsNullOrEmpty(info.OpenSequence)) anim.PlayThen(info.OpenSequence, () => anim.PlayRepeating(info.Sequence)); else @@ -85,6 +85,9 @@ namespace OpenRA.Mods.Common.Effects public IEnumerable Render(WorldRenderer wr) { + if (anim == null) + yield break; + var world = args.SourceActor.World; if (!world.FogObscures(pos)) { From 03dd192de87e0a9cc17f26c1cfbd2bf7cdfd17ca Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 6 Mar 2016 15:33:13 +0100 Subject: [PATCH 2/2] Make shadow palette of GravityBomb configurable --- OpenRA.Mods.Common/Effects/GravityBomb.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Effects/GravityBomb.cs b/OpenRA.Mods.Common/Effects/GravityBomb.cs index 504d73f400..952094724f 100644 --- a/OpenRA.Mods.Common/Effects/GravityBomb.cs +++ b/OpenRA.Mods.Common/Effects/GravityBomb.cs @@ -31,6 +31,8 @@ namespace OpenRA.Mods.Common.Effects public readonly bool Shadow = false; + [PaletteReference] public readonly string ShadowPalette = "shadow"; + public readonly WDist Velocity = WDist.Zero; [Desc("Value added to velocity every tick.")] @@ -95,7 +97,7 @@ namespace OpenRA.Mods.Common.Effects { var dat = world.Map.DistanceAboveTerrain(pos); var shadowPos = pos - new WVec(0, 0, dat.Length); - foreach (var r in anim.Render(shadowPos, wr.Palette("shadow"))) + foreach (var r in anim.Render(shadowPos, wr.Palette(info.ShadowPalette))) yield return r; }