Fix actors not going back to idle animation after custom animation

This commit is contained in:
reaperrr
2015-11-28 22:21:32 +01:00
parent abed25d293
commit e9ed50a831
7 changed files with 7 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Activities
var wsb = hostBuilding.Trait<WithSpriteBody>(); var wsb = hostBuilding.Trait<WithSpriteBody>();
if (wsb.DefaultAnimation.HasSequence("active")) if (wsb.DefaultAnimation.HasSequence("active"))
wsb.PlayCustomAnimation(hostBuilding, "active"); wsb.PlayCustomAnimation(hostBuilding, "active", () => wsb.CancelCustomAnimation(self));
var sound = pool.Info.RearmSound; var sound = pool.Info.RearmSound;
if (sound != null) if (sound != null)

View File

@@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits
// Harvester was killed while unloading // Harvester was killed while unloading
if (dockedHarv != null && dockedHarv.IsDead) if (dockedHarv != null && dockedHarv.IsDead)
{ {
wsb.PlayCustomAnimation(self, wsb.Info.Sequence); wsb.CancelCustomAnimation(self);
dockedHarv = null; dockedHarv = null;
} }

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
if (--ticks <= 0) if (--ticks <= 0)
{ {
if (!(info.PauseOnLowPower && self.IsDisabled())) if (!(info.PauseOnLowPower && self.IsDisabled()))
wsb.PlayCustomAnimation(self, info.Sequence); wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self));
ticks = info.Interval; ticks = info.Interval;
} }
} }

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
public void Charging(Actor self, Target target) public void Charging(Actor self, Target target)
{ {
wsb.PlayCustomAnimation(self, info.ChargeSequence); wsb.PlayCustomAnimation(self, info.ChargeSequence, () => wsb.CancelCustomAnimation(self));
} }
} }
} }

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
var spriteBody = host.TraitOrDefault<WithSpriteBody>(); var spriteBody = host.TraitOrDefault<WithSpriteBody>();
if (spriteBody != null && !(info.PauseOnLowPower && self.IsDisabled())) if (spriteBody != null && !(info.PauseOnLowPower && self.IsDisabled()))
spriteBody.PlayCustomAnimation(host, info.Sequence); spriteBody.PlayCustomAnimation(host, info.Sequence, () => spriteBody.CancelCustomAnimation(self));
} }
} }
} }

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits
var wsb = self.TraitOrDefault<WithSpriteBody>(); var wsb = self.TraitOrDefault<WithSpriteBody>();
if (wsb != null && wsb.DefaultAnimation.HasSequence(info.GrantUpgradeSequence)) if (wsb != null && wsb.DefaultAnimation.HasSequence(info.GrantUpgradeSequence))
wsb.PlayCustomAnimation(self, info.GrantUpgradeSequence); wsb.PlayCustomAnimation(self, info.GrantUpgradeSequence, () => wsb.CancelCustomAnimation(self));
Game.Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation)); Game.Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation));

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits
if (!string.IsNullOrEmpty(info.ActivationSequence)) if (!string.IsNullOrEmpty(info.ActivationSequence))
{ {
var wsb = self.Trait<WithSpriteBody>(); var wsb = self.Trait<WithSpriteBody>();
wsb.PlayCustomAnimation(self, info.ActivationSequence); wsb.PlayCustomAnimation(self, info.ActivationSequence, () => wsb.CancelCustomAnimation(self));
} }
var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation); var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation);