From ea136838c01eecc25df4d94128492f1b8b17d9c8 Mon Sep 17 00:00:00 2001 From: Cojoke <83733158+Cojoke-dot@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:07:35 -0500 Subject: [PATCH] Another QSI Fix About Things Being in Places they Should not (#30241) * Another QSI Fix About Things Being in Places they Should not * cleanup --- .../Systems/SwapTeleporterSystem.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs b/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs index 3852f260f7..0fbaefc31b 100644 --- a/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs +++ b/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs @@ -150,8 +150,11 @@ public sealed class SwapTeleporterSystem : EntitySystem return; } - var (teleEnt, cont) = GetTeleportingEntity((uid, xform)); - var (otherTeleEnt, otherCont) = GetTeleportingEntity((linkedEnt, Transform(linkedEnt))); + var teleEnt = GetTeleportingEntity((uid, xform)); + var otherTeleEnt = GetTeleportingEntity((linkedEnt, Transform(linkedEnt))); + + _container.TryGetOuterContainer(teleEnt, Transform(teleEnt), out var cont); + _container.TryGetOuterContainer(otherTeleEnt, Transform(otherTeleEnt), out var otherCont); if (otherCont != null && !_container.CanInsert(teleEnt, otherCont) || cont != null && !_container.CanInsert(otherTeleEnt, cont)) @@ -195,20 +198,18 @@ public sealed class SwapTeleporterSystem : EntitySystem DestroyLink(linked, user); // the linked one is shown globally } - private (EntityUid, BaseContainer?) GetTeleportingEntity(Entity ent) + private EntityUid GetTeleportingEntity(Entity ent) { var parent = ent.Comp.ParentUid; - if (_container.TryGetOuterContainer(ent, ent, out var container)) - parent = container.Owner; if (HasComp(parent) || HasComp(parent)) - return (ent, container); + return ent; if (!_xformQuery.TryGetComponent(parent, out var parentXform) || parentXform.Anchored) - return (ent, container); + return ent; if (!TryComp(parent, out var body) || body.BodyType == BodyType.Static) - return (ent, container); + return ent; return GetTeleportingEntity((parent, parentXform)); } -- 2.52.0