diff --git a/OpenRA.Mods.Common/Effects/Contrail.cs b/OpenRA.Mods.Common/Effects/Contrail.cs index 04833b0128..a9750cba18 100644 --- a/OpenRA.Mods.Common/Effects/Contrail.cs +++ b/OpenRA.Mods.Common/Effects/Contrail.cs @@ -42,10 +42,11 @@ namespace OpenRA.Mods.Common.Effects public object Create(ActorInitializer init) { return new Contrail(init.Self, this); } } - class Contrail : ITick, IRender + class Contrail : ITick, IRender, INotifyAddedToWorld { readonly ContrailInfo info; readonly BodyOrientation body; + readonly Color color; // This is a mutable struct, so it can't be readonly. ContrailRenderable trail; @@ -54,7 +55,7 @@ namespace OpenRA.Mods.Common.Effects { this.info = info; - var color = info.UsePlayerColor ? ContrailRenderable.ChooseColor(self) : info.Color; + color = info.UsePlayerColor ? ContrailRenderable.ChooseColor(self) : info.Color; trail = new ContrailRenderable(self.World, color, info.TrailWidth, info.TrailLength, 0, info.ZOffset); body = self.Trait(); @@ -70,5 +71,10 @@ namespace OpenRA.Mods.Common.Effects { return new IRenderable[] { trail }; } + + public void AddedToWorld(Actor self) + { + trail = new ContrailRenderable(self.World, color, info.TrailWidth, info.TrailLength, 0, info.ZOffset); + } } }