diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index 60dbfbde96..f827e88271 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -32,7 +32,7 @@ namespace Content.IntegrationTests.Tests.Disposal var insertTransform = EntityManager.GetComponent(toInsert); var unitTransform = EntityManager.GetComponent(unit); // Not in a tube yet - Assert.That(insertTransform.Parent, Is.EqualTo(unitTransform)); + Assert.That(insertTransform.ParentUid, Is.EqualTo(unit)); }, after: new[] {typeof(SharedDisposalUnitSystem)}); } } diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index f6a4d9dc3a..65e68d7b9a 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -123,15 +123,16 @@ namespace Content.IntegrationTests.Tests private static bool IsDescendant(EntityUid descendant, EntityUid parent) { - var tmpParent = IoCManager.Resolve().GetComponent(descendant).Parent; - while (tmpParent != null) + var xforms = IoCManager.Resolve().GetEntityQuery(); + 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; diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index 64296ac34b..d6618105c1 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -331,7 +331,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click await server.WaitAssertion(() => { Assert.That(container.Insert(user)); - Assert.That(sEntities.GetComponent(user).Parent.Owner, Is.EqualTo(containerEntity)); + Assert.That(sEntities.GetComponent(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; }; diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index cec6851e87..38e922fac5 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -87,12 +87,17 @@ namespace Content.Server.Physics.Controllers if (!rotatable.RotateWhilePulling) return; - var pulledXform = Transform(pulled); + var xforms = GetEntityQuery(); + 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); } } } diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index 739eb3431b..39d2ee2668 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -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); } }