Fix infantry getting stuck in the last attack frame
This commit is contained in:
@@ -69,12 +69,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
rs.Add(new AnimationWithOffset(DefaultAnimation, null, () => IsTraitDisabled));
|
rs.Add(new AnimationWithOffset(DefaultAnimation, null, () => IsTraitDisabled));
|
||||||
PlayStandAnimation(self);
|
PlayStandAnimation(self);
|
||||||
|
|
||||||
state = AnimationState.Waiting;
|
|
||||||
move = init.Self.Trait<IMove>();
|
move = init.Self.Trait<IMove>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayStandAnimation(Actor self)
|
public void PlayStandAnimation(Actor self)
|
||||||
{
|
{
|
||||||
|
state = AnimationState.Waiting;
|
||||||
|
|
||||||
var sequence = DefaultAnimation.GetRandomExistingSequence(Info.StandSequences, Game.CosmeticRandom);
|
var sequence = DefaultAnimation.GetRandomExistingSequence(Info.StandSequences, Game.CosmeticRandom);
|
||||||
if (sequence != null)
|
if (sequence != null)
|
||||||
{
|
{
|
||||||
@@ -96,8 +97,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
if (DefaultAnimation.HasSequence(prefix + baseSequence))
|
if (DefaultAnimation.HasSequence(prefix + baseSequence))
|
||||||
return prefix + baseSequence;
|
return prefix + baseSequence;
|
||||||
else
|
|
||||||
return baseSequence;
|
return baseSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool AllowIdleAnimation(Actor self)
|
protected virtual bool AllowIdleAnimation(Actor self)
|
||||||
@@ -114,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
if (!string.IsNullOrEmpty(sequence) && DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, sequence)))
|
if (!string.IsNullOrEmpty(sequence) && DefaultAnimation.HasSequence(NormalizeInfantrySequence(self, sequence)))
|
||||||
{
|
{
|
||||||
state = AnimationState.Attacking;
|
state = AnimationState.Attacking;
|
||||||
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, sequence), () => state = AnimationState.Idle);
|
DefaultAnimation.PlayThen(NormalizeInfantrySequence(self, sequence), () => PlayStandAnimation(self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,10 +148,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
}
|
}
|
||||||
else if (((state == AnimationState.Moving || dirty) && !move.IsMoving)
|
else if (((state == AnimationState.Moving || dirty) && !move.IsMoving)
|
||||||
|| ((state == AnimationState.Idle || state == AnimationState.IdleAnimating) && !self.IsIdle))
|
|| ((state == AnimationState.Idle || state == AnimationState.IdleAnimating) && !self.IsIdle))
|
||||||
{
|
|
||||||
state = AnimationState.Waiting;
|
|
||||||
PlayStandAnimation(self);
|
PlayStandAnimation(self);
|
||||||
}
|
|
||||||
|
|
||||||
dirty = false;
|
dirty = false;
|
||||||
}
|
}
|
||||||
@@ -175,18 +173,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
if (idleDelay > 0 && --idleDelay == 0)
|
if (idleDelay > 0 && --idleDelay == 0)
|
||||||
{
|
{
|
||||||
state = AnimationState.IdleAnimating;
|
state = AnimationState.IdleAnimating;
|
||||||
DefaultAnimation.PlayThen(idleSequence, () =>
|
DefaultAnimation.PlayThen(idleSequence, () => PlayStandAnimation(self));
|
||||||
{
|
|
||||||
PlayStandAnimation(self);
|
|
||||||
state = AnimationState.Waiting;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
PlayStandAnimation(self);
|
PlayStandAnimation(self);
|
||||||
state = AnimationState.Waiting;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user