Fix contrail gets rendered between loading in and loading out position
This commit is contained in:
@@ -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<BodyOrientation>();
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user