Add backpack bombing (#1156)
* Change exploding storages to explode their contents as well * Change storages to only trigger content explosions when the severity is heavy or destruction * Make inventories explode their contents as well * Change InventoryComponent IExAct into an explicit implementation * Change chain explosions to only trigger for explosion severities larger than or equal to heavy
This commit is contained in:
@@ -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<IExAct>();
|
||||
foreach (var exAct in exActs)
|
||||
{
|
||||
exAct.OnExplosion(eventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user