Skip to content

Commit

Permalink
Fix animation looping bugs. (space-wizards#29457)
Browse files Browse the repository at this point in the history
Summary of the problem is in the corresponding engine commit: space-wizards/RobustToolbox@a4ea5a4

This commit requires engine master right now.

I think space-wizards#29144 is probably the most severe one, but I touched Jittering and RotatingLight too since they seemed sus too.

Fixes space-wizards#29144

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
  • Loading branch information
PJB3005 and metalgearsloth authored Jul 4, 2024
1 parent bc79077 commit 8d015f5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Content.Client/Jittering/JitteringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ private void OnAnimationCompleted(EntityUid uid, JitteringComponent jittering, A
if(args.Key != _jitterAnimationKey)
return;

if (!args.Finished)
return;

if (TryComp(uid, out AnimationPlayerComponent? animationPlayer)
&& TryComp(uid, out SpriteComponent? sprite))
_animationPlayer.Play(uid, animationPlayer, GetAnimation(jittering, sprite), _jitterAnimationKey);
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Light/EntitySystems/LightBehaviorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public override void Initialize()

private void OnBehaviorAnimationCompleted(EntityUid uid, LightBehaviourComponent component, AnimationCompletedEvent args)
{
if (!args.Finished)
return;

var container = component.Animations.FirstOrDefault(x => x.FullKey == args.Key);

if (container == null)
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Light/EntitySystems/RotatingLightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ private void OnAfterAutoHandleState(EntityUid uid, RotatingLightComponent comp,

private void OnAnimationComplete(EntityUid uid, RotatingLightComponent comp, AnimationCompletedEvent args)
{
if (!args.Finished)
return;

PlayAnimation(uid, comp);
}

Expand Down

0 comments on commit 8d015f5

Please sign in to comment.