* Add pirate shooting * Shooting working * Basics working * Refactor time * More conversion * Update primitives * Update yml * weh * Building again * Draft * weh * b * Start shutdown * Starting to take form * Code side done * is it worky * Fix prototypes * stuff * Shitty working * Juke events working * Even more cleanup * RTX * Fix interaction combat mode and compquery * GetAmmoCount relays * Fix rotation speed * Juke fixes * fixes * weh * The collision avoidance never ends * Fixes * Pause support * framework * lazy * Fix idling * Fix drip * goobed * Fix takeover shutdown bug * Merge fixes * shitter * Fix carpos
32 lines
989 B
C#
32 lines
989 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 class DropOperator : HTNOperator
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
|
|
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
|
{
|
|
if (!blackboard.TryGetValue(NPCBlackboard.ActiveHand, out Hand? 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;
|
|
}
|
|
}
|