Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gliding #2016

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading