From 13b39a5dcdb995be7d96d6dacaa976d0530ecf8b Mon Sep 17 00:00:00 2001 From: Kevin Zheng Date: Sat, 29 Oct 2022 22:58:24 -0700 Subject: [PATCH] Fix rotated chair draw depth (#12272) --- Content.Client/Buckle/BuckleComponent.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Client/Buckle/BuckleComponent.cs b/Content.Client/Buckle/BuckleComponent.cs index 1bc43c3ce9..dd36dcf454 100644 --- a/Content.Client/Buckle/BuckleComponent.cs +++ b/Content.Client/Buckle/BuckleComponent.cs @@ -46,7 +46,12 @@ namespace Content.Client.Buckle return; } + // Adjust draw depth when the chair faces north so that the seat back is drawn over the player. + // Reset the draw depth when rotated in any other direction. // TODO when ECSing, make this a visualizer + // This code was written before rotatable viewports were introduced, so hard-coding Direction.North + // and comparing it against LocalRotation now breaks this in other rotations. This is a FIXME, but + // better to get it working for most people before we look at a more permanent solution. if (_buckled && LastEntityBuckledTo != null && EntMan.GetComponent(LastEntityBuckledTo.Value).LocalRotation.GetCardinalDir() == Direction.North && @@ -57,7 +62,8 @@ namespace Content.Client.Buckle return; } - if (_originalDrawDepth.HasValue && !_buckled) + // If here, we're not turning north and should restore the saved draw depth. + if (_originalDrawDepth.HasValue) { ownerSprite.DrawDepth = _originalDrawDepth.Value; _originalDrawDepth = null;