Files
tbd-station-14/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Interactions/DropOperator.cs
Nemanja 524725d378 HandsSystem Refactor (#38438)
* checkpoint

* pt 2

* pt... i forgot

* pt 4

* patch

* More test fixes

* optimization!!!

* the REAL hand system

* fix RetractableItemActionSystem.cs oversight

* the review

* test

* remove test usage of body prototype

* Update Content.IntegrationTests/Tests/Interaction/InteractionTest.cs

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>

* hellcode

* hellcode 2

* Minor cleanup

* test

* Chasing the last of the bugs

* changes

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2025-06-25 15:13:03 +02:00

32 lines
999 B
C#

using Content.Server.Hands.Systems;
using Content.Shared.Hands.Components;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Interactions;
/// <summary>
/// Drops the active hand entity underneath us.
/// </summary>
public sealed partial class DropOperator : HTNOperator
{
[Dependency] private readonly IEntityManager _entManager = default!;
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
{
if (!blackboard.TryGetValue(NPCBlackboard.ActiveHand, out string? activeHand, _entManager))
{
return HTNOperatorStatus.Finished;
}
var owner = blackboard.GetValueOrDefault<EntityUid>(NPCBlackboard.Owner, _entManager);
// TODO: Need some sort of interaction cooldown probably.
var handsSystem = _entManager.System<HandsSystem>();
if (handsSystem.TryDrop(owner))
{
return HTNOperatorStatus.Finished;
}
return HTNOperatorStatus.Failed;
}
}