From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Sat, 21 Jun 2025 13:11:17 +0000 (+0200) Subject: Fix wallmount interaction (#38111) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=686016098a88d67c393724691b0b8469c18f6e62;p=space-station-14.git Fix wallmount interaction (#38111) --- diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 91b3ffea0d..2c75cef132 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -747,7 +747,7 @@ namespace Content.Shared.Interaction var inRange = true; MapCoordinates originPos = default; var targetPos = _transform.ToMapCoordinates(otherCoordinates); - Angle targetRot = default; + Angle targetRot = _transform.GetWorldRotation(otherCoordinates.EntityId) + otherAngle; // So essentially: // 1. If fixtures available check nearest point. We take in coordinates / angles because we might want to use a lag compensated position @@ -766,8 +766,7 @@ namespace Content.Shared.Interaction { var (worldPosA, worldRotA) = _transform.GetWorldPositionRotation(origin.Comp); var xfA = new Transform(worldPosA, worldRotA); - var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId); - var xfB = new Transform(targetPos.Position, parentRotB + otherAngle); + var xfB = new Transform(targetPos.Position, targetRot); // Different map or the likes. if (!_broadphase.TryGetNearest( @@ -809,8 +808,6 @@ namespace Content.Shared.Interaction else { originPos = _transform.GetMapCoordinates(origin, origin); - var otherParent = (other.Comp ?? Transform(other)).ParentUid; - targetRot = otherParent.IsValid() ? Transform(otherParent).LocalRotation + otherAngle : otherAngle; } // Do a raycast to check if relevant @@ -851,7 +848,7 @@ namespace Content.Shared.Interaction /// if the target entity is a wallmount we ignore all other entities on the tile. /// private Ignored GetPredicate( - MapCoordinates origin, + MapCoordinates originCoords, EntityUid target, MapCoordinates targetCoords, Angle targetRotation, @@ -871,7 +868,7 @@ namespace Content.Shared.Interaction if (target == otherEnt || !_physicsQuery.TryComp(otherEnt, out var otherBody) || !otherBody.CanCollide || - ((int) collisionMask & otherBody.CollisionLayer) == 0x0) + ((int)collisionMask & otherBody.CollisionLayer) == 0x0) { continue; } @@ -888,7 +885,7 @@ namespace Content.Shared.Interaction ignoreAnchored = true; else { - var angle = Angle.FromWorldVec(origin.Position - targetCoords.Position); + var angle = Angle.FromWorldVec(originCoords.Position - targetCoords.Position); var angleDelta = (wallMount.Direction + targetRotation - angle).Reduced().FlipPositive(); ignoreAnchored = angleDelta < wallMount.Arc / 2 || Math.Tau - angleDelta < wallMount.Arc / 2; }