Allow WithIdleOverlayInfo to render while the actor is being build.
This commit is contained in:
@@ -35,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Custom palette is a player palette BaseName")]
|
||||
public readonly bool IsPlayerPalette = false;
|
||||
|
||||
// TODO: Remove this when the buildComplete code is replaced with conditions.
|
||||
public readonly bool RenderBeforeBuildComplete = false;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new WithIdleOverlay(init.Self, this); }
|
||||
|
||||
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||
@@ -82,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var body = self.Trait<BodyOrientation>();
|
||||
|
||||
buildComplete = !self.Info.HasTraitInfo<BuildingInfo>(); // always render instantly for units
|
||||
overlay = new Animation(self.World, rs.GetImage(self), () => IsTraitPaused || !buildComplete);
|
||||
overlay = new Animation(self.World, rs.GetImage(self), () => IsTraitPaused || (!info.RenderBeforeBuildComplete && !buildComplete));
|
||||
if (info.StartSequence != null)
|
||||
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence),
|
||||
() => overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence)));
|
||||
@@ -91,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
var anim = new AnimationWithOffset(overlay,
|
||||
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
() => IsTraitDisabled || !buildComplete,
|
||||
() => IsTraitDisabled || (!info.RenderBeforeBuildComplete && !buildComplete),
|
||||
p => RenderUtils.ZOffsetFromCenter(self, p, 1));
|
||||
|
||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
||||
|
||||
Reference in New Issue
Block a user