Remove some obsoleted transform methods/properties (#13457)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user