diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index 102b461fe0..aa3f114c0e 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -406,6 +406,19 @@ public sealed partial class ExplosionSystem _damageableSystem.TryChangeDamage(uid, damage, ignoreResistances: true, damageable: damageable); } + // if it's a container, try to damage all its contents + if (_containersQuery.TryGetComponent(uid, out var containers)) + { + foreach (var container in containers.Containers.Values) + { + foreach (var ent in container.ContainedEntities) + { + // setting throw force to 0 to prevent offset items inside containers + ProcessEntity(ent, epicenter, damage, 0f, id, _transformQuery.GetComponent(uid)); + } + } + } + // throw if (xform != null // null implies anchored && !xform.Anchored diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index aa1ad71b16..2ddf314fa1 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -21,6 +21,7 @@ using Robust.Server.GameStates; using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.Configuration; +using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Player; @@ -51,6 +52,7 @@ public sealed partial class ExplosionSystem : EntitySystem [Dependency] private readonly SharedTransformSystem _transformSystem = default!; private EntityQuery _transformQuery; + private EntityQuery _containersQuery; private EntityQuery _damageQuery; private EntityQuery _physicsQuery; private EntityQuery _projectileQuery; @@ -104,6 +106,7 @@ public sealed partial class ExplosionSystem : EntitySystem InitVisuals(); _transformQuery = GetEntityQuery(); + _containersQuery = GetEntityQuery(); _damageQuery = GetEntityQuery(); _physicsQuery = GetEntityQuery(); _projectileQuery = GetEntityQuery();