Breakable light (#3237)

This commit is contained in:
Alex Evgrashin
2021-02-16 11:40:43 +03:00
committed by GitHub
parent 1e0da06488
commit 292a618141
4 changed files with 79 additions and 27 deletions

View File

@@ -0,0 +1,30 @@
#nullable enable
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
{
/// <summary>
/// Drop all items from all containers
/// </summary>
public class EmptyAllContainersBehaviour : IThresholdBehavior
{
void IExposeData.ExposeData(ObjectSerializer serializer) { }
public void Execute(IEntity owner, DestructibleSystem system)
{
if (owner.Deleted || !owner.TryGetComponent<ContainerManagerComponent>(out var containerManager))
return;
foreach (var container in containerManager.GetAllContainers())
{
container.EmptyContainer(true, owner.Transform.Coordinates);
}
}
}
}