Fix wallmount interaction (#38111)
This commit is contained in:
@@ -747,7 +747,7 @@ namespace Content.Shared.Interaction
|
|||||||
var inRange = true;
|
var inRange = true;
|
||||||
MapCoordinates originPos = default;
|
MapCoordinates originPos = default;
|
||||||
var targetPos = _transform.ToMapCoordinates(otherCoordinates);
|
var targetPos = _transform.ToMapCoordinates(otherCoordinates);
|
||||||
Angle targetRot = default;
|
Angle targetRot = _transform.GetWorldRotation(otherCoordinates.EntityId) + otherAngle;
|
||||||
|
|
||||||
// So essentially:
|
// So essentially:
|
||||||
// 1. If fixtures available check nearest point. We take in coordinates / angles because we might want to use a lag compensated position
|
// 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 (worldPosA, worldRotA) = _transform.GetWorldPositionRotation(origin.Comp);
|
||||||
var xfA = new Transform(worldPosA, worldRotA);
|
var xfA = new Transform(worldPosA, worldRotA);
|
||||||
var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId);
|
var xfB = new Transform(targetPos.Position, targetRot);
|
||||||
var xfB = new Transform(targetPos.Position, parentRotB + otherAngle);
|
|
||||||
|
|
||||||
// Different map or the likes.
|
// Different map or the likes.
|
||||||
if (!_broadphase.TryGetNearest(
|
if (!_broadphase.TryGetNearest(
|
||||||
@@ -809,8 +808,6 @@ namespace Content.Shared.Interaction
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
originPos = _transform.GetMapCoordinates(origin, origin);
|
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
|
// 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.
|
/// if the target entity is a wallmount we ignore all other entities on the tile.
|
||||||
/// </example>
|
/// </example>
|
||||||
private Ignored GetPredicate(
|
private Ignored GetPredicate(
|
||||||
MapCoordinates origin,
|
MapCoordinates originCoords,
|
||||||
EntityUid target,
|
EntityUid target,
|
||||||
MapCoordinates targetCoords,
|
MapCoordinates targetCoords,
|
||||||
Angle targetRotation,
|
Angle targetRotation,
|
||||||
@@ -888,7 +885,7 @@ namespace Content.Shared.Interaction
|
|||||||
ignoreAnchored = true;
|
ignoreAnchored = true;
|
||||||
else
|
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();
|
var angleDelta = (wallMount.Direction + targetRotation - angle).Reduced().FlipPositive();
|
||||||
ignoreAnchored = angleDelta < wallMount.Arc / 2 || Math.Tau - angleDelta < wallMount.Arc / 2;
|
ignoreAnchored = angleDelta < wallMount.Arc / 2 || Math.Tau - angleDelta < wallMount.Arc / 2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user