Files
tbd-station-14/Content.Server/AI/Operators/Inventory/DropEntityOperator.cs
Leon Friedrich bfd95c493b hands ECS (#7081)
2022-03-17 18:13:31 +11:00

27 lines
872 B
C#

using Content.Server.Hands.Components;
using Content.Shared.Hands.EntitySystems;
namespace Content.Server.AI.Operators.Inventory
{
public sealed class DropEntityOperator : AiOperator
{
private readonly EntityUid _owner;
private readonly EntityUid _entity;
public DropEntityOperator(EntityUid owner, EntityUid entity)
{
_owner = owner;
_entity = entity;
}
/// <summary>
/// Requires EquipEntityOperator to put it in the active hand first
/// </summary>
/// <param name="frameTime"></param>
/// <returns></returns>
public override Outcome Execute(float frameTime)
{
return IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedHandsSystem>().TryDrop(_owner, _entity) ? Outcome.Success : Outcome.Failed;
}
}
}