Convert WithIdleOverlay from actor disabled to pausable-conditional.

This commit is contained in:
atlimit8
2017-03-16 12:15:45 -05:00
parent 11933c7e2c
commit 1c5427c86f
4 changed files with 6 additions and 9 deletions

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits.Render
{
[Desc("Renders a decorative animation on units and buildings.")]
public class WithIdleOverlayInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
public class WithIdleOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
{
[Desc("Animation to play when the actor is created.")]
[SequenceReference] public readonly string StartSequence = null;
@@ -35,8 +35,6 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;
public readonly bool PauseOnLowPower = 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)
@@ -72,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
}
public class WithIdleOverlay : ConditionalTrait<WithIdleOverlayInfo>, INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyTransform
public class WithIdleOverlay : PausableConditionalTrait<WithIdleOverlayInfo>, INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyTransform
{
readonly Animation overlay;
bool buildComplete;
@@ -84,8 +82,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),
() => (info.PauseOnLowPower && self.IsDisabled()) || !buildComplete);
overlay = new Animation(self.World, rs.GetImage(self), () => IsTraitPaused || !buildComplete);
if (info.StartSequence != null)
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence),
() => overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence)));

View File

@@ -525,7 +525,7 @@ outpost:
mercenary: outpost.ordos
WithIdleOverlay@DISH:
Sequence: idle-dish
PauseOnLowPower: true
PauseOnCondition: disabled
RequiresCondition: !severe-damaged
GrantConditionOnDamageState@STOPDISH:
Condition: severe-damaged

View File

@@ -326,7 +326,7 @@ GARADR:
MaxHeightDelta: 3
WithIdleOverlay@DISH:
Sequence: idle-dish
PauseOnLowPower: yes
PauseOnCondition: disabled
Targetable:
TargetTypes: Ground, C4, SpyInfiltrate
Power:

View File

@@ -285,7 +285,7 @@ NARADR:
MaxHeightDelta: 3
WithIdleOverlay@DISH:
Sequence: idle-dish
PauseOnLowPower: true
PauseOnCondition: disabled
Targetable:
TargetTypes: Ground, C4, SpyInfiltrate
Power: