diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index cc48a4604c..0c698f434d 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -22,7 +22,7 @@ using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventory namespace Content.Server.GameObjects { [RegisterComponent] - public class InventoryComponent : SharedInventoryComponent + public class InventoryComponent : SharedInventoryComponent, IExAct { #pragma warning disable 649 [Dependency] private readonly IEntitySystemManager _entitySystemManager; @@ -396,5 +396,25 @@ namespace Content.Server.GameObjects } return new InventoryComponentState(list); } + + void IExAct.OnExplosion(ExplosionEventArgs eventArgs) + { + if (eventArgs.Severity < ExplosionSeverity.Heavy) + { + return; + } + + foreach (var slot in SlotContainers.Values.ToList()) + { + foreach (var entity in slot.ContainedEntities) + { + var exActs = entity.GetAllComponents(); + foreach (var exAct in exActs) + { + exAct.OnExplosion(eventArgs); + } + } + } + } } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 27bbc2c942..efff79896e 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.GameObjects [RegisterComponent] [ComponentReference(typeof(IActivate))] [ComponentReference(typeof(IStorageComponent))] - public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct + public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct { #pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager; @@ -364,6 +364,24 @@ namespace Content.Server.GameObjects } } + void IExAct.OnExplosion(ExplosionEventArgs eventArgs) + { + if (eventArgs.Severity < ExplosionSeverity.Heavy) + { + return; + } + + var storedEntities = storage.ContainedEntities.ToList(); + foreach (var entity in storedEntities) + { + var exActs = entity.GetAllComponents(); + foreach (var exAct in exActs) + { + exAct.OnExplosion(eventArgs); + } + } + } + /// /// Inserts an entity into the storage component from the players active hand. /// diff --git a/Content.Server/GameObjects/EntitySystems/ActSystem.cs b/Content.Server/GameObjects/EntitySystems/ActSystem.cs index 035cac5218..56be8389ea 100644 --- a/Content.Server/GameObjects/EntitySystems/ActSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ActSystem.cs @@ -102,8 +102,8 @@ namespace Content.Server.GameObjects.EntitySystems } public enum ExplosionSeverity { - Destruction, - Heavy, Light, + Heavy, + Destruction, } }