require body orientation for idle overlays

and don't wait for BuildingComplete to generalize for units
This commit is contained in:
Matthias Mailänder
2013-08-13 23:51:31 +02:00
parent aaf1904257
commit 94c3090528

View File

@@ -11,10 +11,11 @@
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Mods.RA.Buildings;
namespace OpenRA.Mods.RA.Render
{
public class WithIdleOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
public class WithIdleOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
{
[Desc("Sequence name to use")]
public readonly string Sequence = "idle-overlay";
@@ -35,6 +36,7 @@ namespace OpenRA.Mods.RA.Render
var rs = self.Trait<RenderSprites>();
var body = self.Trait<IBodyOrientation>();
buildComplete = !self.HasTrait<Building>(); // always render instantly for units
overlay = new Animation(rs.GetImage(self));
overlay.PlayRepeating(info.Sequence);
rs.anims.Add("idle_overlay_{0}".F(info.Sequence),