patch QSI container issues (#25700)
* patch QSI exception * fuck don't die
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Teleportation.Components;
|
using Content.Shared.Teleportation.Components;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
@@ -20,6 +21,7 @@ public sealed class SwapTeleporterSystem : EntitySystem
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
|
|
||||||
@@ -155,6 +157,13 @@ public sealed class SwapTeleporterSystem : EntitySystem
|
|||||||
var pos = teleEntXform.Coordinates;
|
var pos = teleEntXform.Coordinates;
|
||||||
var otherPos = otherTeleEntXform.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(teleEnt, otherPos);
|
||||||
_transform.SetCoordinates(otherTeleEnt, pos);
|
_transform.SetCoordinates(otherTeleEnt, pos);
|
||||||
}
|
}
|
||||||
@@ -185,6 +194,8 @@ public sealed class SwapTeleporterSystem : EntitySystem
|
|||||||
private EntityUid GetTeleportingEntity(Entity<TransformComponent> ent)
|
private EntityUid GetTeleportingEntity(Entity<TransformComponent> ent)
|
||||||
{
|
{
|
||||||
var parent = ent.Comp.ParentUid;
|
var parent = ent.Comp.ParentUid;
|
||||||
|
if (_container.TryGetOuterContainer(ent, ent, out var container))
|
||||||
|
parent = container.Owner;
|
||||||
|
|
||||||
if (HasComp<MapGridComponent>(parent) || HasComp<MapComponent>(parent))
|
if (HasComp<MapGridComponent>(parent) || HasComp<MapComponent>(parent))
|
||||||
return ent;
|
return ent;
|
||||||
|
|||||||
Reference in New Issue
Block a user