23 lines
859 B
C#
23 lines
859 B
C#
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Server.Destructible.Thresholds.Behaviors
|
|
{
|
|
/// <summary>
|
|
/// Drop all items from all containers
|
|
/// </summary>
|
|
[DataDefinition]
|
|
public sealed partial class EmptyAllContainersBehaviour : IThresholdBehavior
|
|
{
|
|
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
|
{
|
|
if (!system.EntityManager.TryGetComponent<ContainerManagerComponent>(owner, out var containerManager))
|
|
return;
|
|
|
|
foreach (var container in system.EntityManager.System<SharedContainerSystem>().GetAllContainers(owner, containerManager))
|
|
{
|
|
system.ContainerSystem.EmptyContainer(container, true, system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates);
|
|
}
|
|
}
|
|
}
|
|
}
|