2021-02-16 11:40:43 +03:00
|
|
|
using Robust.Shared.Containers;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Destructible.Thresholds.Behaviors
|
2021-02-16 11:40:43 +03:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Drop all items from all containers
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataDefinition]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class EmptyAllContainersBehaviour : IThresholdBehavior
|
2021-02-16 11:40:43 +03:00
|
|
|
{
|
2021-11-09 21:24:35 +01:00
|
|
|
public void Execute(EntityUid owner, DestructibleSystem system)
|
2021-02-16 11:40:43 +03:00
|
|
|
{
|
2021-11-09 21:24:35 +01:00
|
|
|
if (!system.EntityManager.TryGetComponent<ContainerManagerComponent>(owner, out var containerManager))
|
2021-02-16 11:40:43 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
foreach (var container in containerManager.GetAllContainers())
|
|
|
|
|
{
|
2021-11-09 21:24:35 +01:00
|
|
|
container.EmptyContainer(true, system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates);
|
2021-02-16 11:40:43 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|