diff --git a/Content.Server/Salvage/FultonSystem.cs b/Content.Server/Salvage/FultonSystem.cs index b16339e05a..a0921f3561 100644 --- a/Content.Server/Salvage/FultonSystem.cs +++ b/Content.Server/Salvage/FultonSystem.cs @@ -1,7 +1,6 @@ -using System.Numerics; using Content.Shared.Salvage.Fulton; +using Robust.Shared.Containers; using Robust.Shared.Map; -using Robust.Shared.Prototypes; using Robust.Shared.Random; namespace Content.Server.Salvage; @@ -9,6 +8,7 @@ namespace Content.Server.Salvage; public sealed class FultonSystem : SharedFultonSystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; public override void Initialize() { @@ -50,12 +50,14 @@ public sealed class FultonSystem : SharedFultonSystem private void Fulton(EntityUid uid, FultonedComponent component) { - if (!Deleted(component.Beacon)) + if (!Deleted(component.Beacon) && + TryComp(component.Beacon, out var beaconXform) && + !_container.IsEntityOrParentInContainer(component.Beacon.Value, xform: beaconXform)) { var xform = Transform(uid); var oldCoords = xform.Coordinates; var offset = _random.NextVector2(1.5f); - TransformSystem.SetCoordinates(uid, new EntityCoordinates(component.Beacon.Value, offset)); + TransformSystem.SetCoordinates(uid, new EntityCoordinates(beaconXform.ParentUid, offset)); RaiseNetworkEvent(new FultonAnimationMessage() {