From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sun, 3 Mar 2024 06:45:26 +0000 (-0500) Subject: patch QSI container issues (#25700) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=9a795b35adba4575f2674f937f8b4bb566b3cb15;p=space-station-14.git patch QSI container issues (#25700) * patch QSI exception * fuck don't die --- diff --git a/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs b/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs index 98a8955c7b..e69a31a1d4 100644 --- a/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs +++ b/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Popups; using Content.Shared.Teleportation.Components; using Content.Shared.Verbs; using Robust.Shared.Audio.Systems; +using Robust.Shared.Containers; using Robust.Shared.Map.Components; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; @@ -20,6 +21,7 @@ public sealed class SwapTeleporterSystem : EntitySystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; @@ -155,6 +157,13 @@ public sealed class SwapTeleporterSystem : EntitySystem var pos = teleEntXform.Coordinates; var otherPos = otherTeleEntXform.Coordinates; + if (_transform.ContainsEntity(teleEnt, (otherTeleEnt, otherTeleEntXform)) || + _transform.ContainsEntity(otherTeleEnt, (teleEnt, teleEntXform))) + { + Log.Error($"Invalid teleport swap attempt between {ToPrettyString(teleEnt)} and {ToPrettyString(otherTeleEnt)}"); + return; + } + _transform.SetCoordinates(teleEnt, otherPos); _transform.SetCoordinates(otherTeleEnt, pos); } @@ -185,6 +194,8 @@ public sealed class SwapTeleporterSystem : EntitySystem 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;