Remove some obsoleted transform methods/properties (#13457)
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
var insertTransform = EntityManager.GetComponent<TransformComponent>(toInsert);
|
||||
var unitTransform = EntityManager.GetComponent<TransformComponent>(unit);
|
||||
// Not in a tube yet
|
||||
Assert.That(insertTransform.Parent, Is.EqualTo(unitTransform));
|
||||
Assert.That(insertTransform.ParentUid, Is.EqualTo(unit));
|
||||
}, after: new[] {typeof(SharedDisposalUnitSystem)});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,15 +123,16 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private static bool IsDescendant(EntityUid descendant, EntityUid parent)
|
||||
{
|
||||
var tmpParent = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(descendant).Parent;
|
||||
while (tmpParent != null)
|
||||
var xforms = IoCManager.Resolve<IEntityManager>().GetEntityQuery<TransformComponent>();
|
||||
var tmpParent = xforms.GetComponent(descendant).ParentUid;
|
||||
while (tmpParent.IsValid())
|
||||
{
|
||||
if (tmpParent.Owner == parent)
|
||||
if (tmpParent == parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
tmpParent = tmpParent.Parent;
|
||||
tmpParent = xforms.GetComponent(tmpParent).ParentUid;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.That(container.Insert(user));
|
||||
Assert.That(sEntities.GetComponent<TransformComponent>(user).Parent.Owner, Is.EqualTo(containerEntity));
|
||||
Assert.That(sEntities.GetComponent<TransformComponent>(user).ParentUid, Is.EqualTo(containerEntity));
|
||||
|
||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactUsing = true; };
|
||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactHand = true; };
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,6 @@ namespace Content.Server.Salvage
|
||||
return;
|
||||
}
|
||||
|
||||
var parentTransform = salvageTransform.Parent!;
|
||||
foreach (var player in Filter.Empty().AddInGrid(salvageTransform.GridUid.Value, EntityManager).Recipients)
|
||||
{
|
||||
if (player.AttachedEntity.HasValue)
|
||||
@@ -244,7 +243,7 @@ namespace Content.Server.Salvage
|
||||
// Salvage mobs are NEVER immune (even if they're from a different salvage, they shouldn't be here)
|
||||
continue;
|
||||
}
|
||||
Transform(playerEntityUid).AttachParent(parentTransform);
|
||||
Transform(playerEntityUid).AttachParent(salvageTransform.ParentUid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user