* 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>
32 lines
999 B
C#
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;
|
|
}
|
|
}
|