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
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class InventoryComponent : SharedInventoryComponent
|
public class InventoryComponent : SharedInventoryComponent, IExAct
|
||||||
{
|
{
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||||
@@ -396,5 +396,25 @@ namespace Content.Server.GameObjects
|
|||||||
}
|
}
|
||||||
return new InventoryComponentState(list);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
[ComponentReference(typeof(IStorageComponent))]
|
[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
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IMapManager _mapManager;
|
[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<IExAct>();
|
||||||
|
foreach (var exAct in exActs)
|
||||||
|
{
|
||||||
|
exAct.OnExplosion(eventArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Inserts an entity into the storage component from the players active hand.
|
/// Inserts an entity into the storage component from the players active hand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
public enum ExplosionSeverity
|
public enum ExplosionSeverity
|
||||||
{
|
{
|
||||||
Destruction,
|
|
||||||
Heavy,
|
|
||||||
Light,
|
Light,
|
||||||
|
Heavy,
|
||||||
|
Destruction,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user