using Content.Shared.EntityTable.EntitySelectors;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityTable.Conditions;
///
/// Condition that passes when a container has nothing in it.
///
public sealed partial class EmptyContainerCondition : EntityTableCondition
{
///
/// Key for to store container that should be checked by this condition.
///
public static readonly EntityTableContextKey ContainerContextKey = new("Container");
/// >
protected override bool EvaluateImplementation(
EntityTableSelector root,
IEntityManager entMan,
IPrototypeManager proto,
EntityTableContext ctx
)
{
if (!ctx.TryGetData(ContainerContextKey, out var container))
return false;
return container.Count == 0;
}
}