Remove some obsoleted transform methods/properties (#13457)

This commit is contained in:
Leon Friedrich
2023-01-14 13:48:48 +13:00
committed by GitHub
parent a98a80f938
commit 899549b770
5 changed files with 18 additions and 13 deletions

View File

@@ -87,12 +87,17 @@ namespace Content.Server.Physics.Controllers
if (!rotatable.RotateWhilePulling)
return;
var pulledXform = Transform(pulled);
var xforms = GetEntityQuery<TransformComponent>();
var pulledXform = xforms.GetComponent(pulled);
var pullerXform = xforms.GetComponent(puller);
var dir = Transform(puller).WorldPosition - pulledXform.WorldPosition;
var pullerData = TransformSystem.GetWorldPositionRotation(pullerXform, xforms);
var pulledData = TransformSystem.GetWorldPositionRotation(pulledXform, xforms);
var dir = pullerData.WorldPosition - pulledData.WorldPosition;
if (dir.LengthSquared > ThresholdRotDistance * ThresholdRotDistance)
{
var oldAngle = pulledXform.WorldRotation;
var oldAngle = pulledData.WorldRotation;
var newAngle = Angle.FromWorldVec(dir);
var diff = newAngle - oldAngle;
@@ -102,10 +107,10 @@ namespace Content.Server.Physics.Controllers
// Otherwise PIANO DOOR STUCK! happens.
// But it also needs to work with station rotation / align to the local parent.
// So...
var baseRotation = pulledXform.Parent?.WorldRotation ?? 0f;
var baseRotation = pulledData.WorldRotation - pulledXform.LocalRotation;
var localRotation = newAngle - baseRotation;
var localRotationSnapped = Angle.FromDegrees(Math.Floor((localRotation.Degrees / ThresholdRotAngle) + 0.5f) * ThresholdRotAngle);
pulledXform.LocalRotation = localRotationSnapped;
TransformSystem.SetLocalRotation(pulledXform, localRotationSnapped);
}
}
}