Files
tbd-station-14/Content.Server/Destructible/Thresholds/Behaviors/EmptyAllContainersBehaviour.cs
Tayrtahn 5ede1f7b4e Cleanup warning in EmptyAllContainersBehaviour (#36860)
Fix warning in EmptyAllContainersBehaviour
2025-04-23 20:33:18 +02:00

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);
}
}
}
}