diff --git a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs index 9b4eb1f58b..6eae6bf66f 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs @@ -9,6 +9,7 @@ using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.Components.Storage; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces; +using Content.Shared.Physics; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.EntitySystems; @@ -49,6 +50,8 @@ namespace Content.Server.GameObjects.Components private bool _showContents; private bool _open; private bool _isWeldedShut; + private int _collisionMaskStorage; + private int _collisionLayerStorage; /// /// Determines if the container contents should be drawn when the container is closed. @@ -182,9 +185,21 @@ namespace Content.Server.GameObjects.Components private void ModifyComponents() { - if (Owner.TryGetComponent(out var collidableComponent)) + if (!IsCollidableWhenOpen && Owner.TryGetComponent(out var collidableComponent)) { - collidableComponent.CanCollide = IsCollidableWhenOpen || !Open; + var physShape = collidableComponent.PhysicsShapes[0]; + if (Open) + { + _collisionMaskStorage = physShape.CollisionMask; + physShape.CollisionMask = (int)CollisionGroup.Impassable; + _collisionLayerStorage = physShape.CollisionLayer; + physShape.CollisionLayer = (int)CollisionGroup.None; + } + else + { + physShape.CollisionMask = _collisionMaskStorage; + physShape.CollisionLayer = _collisionLayerStorage; + } } if (Owner.TryGetComponent(out var placeableSurfaceComponent))