| 12345678910111213141516171819202122 |
- 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 containerManager.GetAllContainers())
- {
- system.ContainerSystem.EmptyContainer(container, true, system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates);
- }
- }
- }
- }
|