Fix actors not going back to idle animation after custom animation
This commit is contained in:
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
var wsb = hostBuilding.Trait<WithSpriteBody>();
|
||||
if (wsb.DefaultAnimation.HasSequence("active"))
|
||||
wsb.PlayCustomAnimation(hostBuilding, "active");
|
||||
wsb.PlayCustomAnimation(hostBuilding, "active", () => wsb.CancelCustomAnimation(self));
|
||||
|
||||
var sound = pool.Info.RearmSound;
|
||||
if (sound != null)
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Harvester was killed while unloading
|
||||
if (dockedHarv != null && dockedHarv.IsDead)
|
||||
{
|
||||
wsb.PlayCustomAnimation(self, wsb.Info.Sequence);
|
||||
wsb.CancelCustomAnimation(self);
|
||||
dockedHarv = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (--ticks <= 0)
|
||||
{
|
||||
if (!(info.PauseOnLowPower && self.IsDisabled()))
|
||||
wsb.PlayCustomAnimation(self, info.Sequence);
|
||||
wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self));
|
||||
ticks = info.Interval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void Charging(Actor self, Target target)
|
||||
{
|
||||
wsb.PlayCustomAnimation(self, info.ChargeSequence);
|
||||
wsb.PlayCustomAnimation(self, info.ChargeSequence, () => wsb.CancelCustomAnimation(self));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var spriteBody = host.TraitOrDefault<WithSpriteBody>();
|
||||
if (spriteBody != null && !(info.PauseOnLowPower && self.IsDisabled()))
|
||||
spriteBody.PlayCustomAnimation(host, info.Sequence);
|
||||
spriteBody.PlayCustomAnimation(host, info.Sequence, () => spriteBody.CancelCustomAnimation(self));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var wsb = self.TraitOrDefault<WithSpriteBody>();
|
||||
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));
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!string.IsNullOrEmpty(info.ActivationSequence))
|
||||
{
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user