Skip to content

Commit

Permalink
Fix gliding (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
wixoaGit authored Oct 5, 2024
1 parent 644ebb1 commit 083f830
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions OpenDreamClient/Rendering/AtomGlideSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ private sealed class Glide(TransformComponent transform, DMISpriteComponent spri
private bool _ignoreMoveEvent;

public override void Initialize() {
_spriteQuery = _entityManager.GetEntityQuery<DMISpriteComponent>();
UpdatesBefore.Add(typeof(SharedTransformSystem));

_spriteQuery = _entityManager.GetEntityQuery<DMISpriteComponent>();

_transformSystem.OnGlobalMoveEvent += OnTransformMove;
}
Expand All @@ -38,6 +39,11 @@ public override void Shutdown() {
}

public override void FrameUpdate(float frameTime) {
// As of writing, Reset() does nothing but clear the transform system's _lerpingTransforms list
// We update before SharedTransformSystem so this serves to disable RT's lerping, which fights our gliding
// TODO: This kinda fights RT. Would be nice to modify RT to make it play nicer.
_transformSystem.Reset();

_ignoreMoveEvent = false;

for (int i = 0; i < _currentGlides.Count; i++) {
Expand Down Expand Up @@ -81,7 +87,6 @@ public override void FrameUpdate(float frameTime) {
}
}

// TODO: This kinda fights RT. Would be nice to modify RT to make it play nicer.
/// <summary>
/// Disables RT lerping and sets up the entity's glide
/// </summary>
Expand Down Expand Up @@ -123,7 +128,6 @@ private void OnTransformMove(ref MoveEvent e) {
}

// Move the transform to our starting point
// Also serves the function of disabling RT's lerp
_transformSystem.SetLocalPositionNoLerp(e.Sender, startingFrom, e.Component);

glide.EndPos = glidingTo;
Expand Down

0 comments on commit 083f830

Please sign in to comment.