2020-07-25 15:11:16 +02:00
|
|
|
using Content.Server.GameObjects.Components.GUI;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-06-18 22:52:44 +10:00
|
|
|
|
|
|
|
|
namespace Content.Server.AI.Operators.Inventory
|
|
|
|
|
{
|
|
|
|
|
public class DropHandItemsOperator : AiOperator
|
|
|
|
|
{
|
|
|
|
|
private readonly IEntity _owner;
|
|
|
|
|
|
|
|
|
|
public DropHandItemsOperator(IEntity owner)
|
|
|
|
|
{
|
|
|
|
|
_owner = owner;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Outcome Execute(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
if (!_owner.TryGetComponent(out HandsComponent handsComponent))
|
|
|
|
|
{
|
|
|
|
|
return Outcome.Failed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in handsComponent.GetAllHeldItems())
|
|
|
|
|
{
|
|
|
|
|
handsComponent.Drop(item.Owner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Outcome.Success;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|