Fix stupid NPC. (#26868)
* init commit * Review --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Content.Shared.Movement.Pulling.Components;
|
||||
using Content.Shared.Movement.Pulling.Systems;
|
||||
|
||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
|
||||
|
||||
public sealed partial class UnPullOperator : HTNOperator
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
private PullingSystem _pulling = default!;
|
||||
|
||||
private EntityQuery<PullableComponent> _pullableQuery;
|
||||
|
||||
[DataField("shutdownState")]
|
||||
public HTNPlanState ShutdownState { get; private set; } = HTNPlanState.TaskFinished;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
{
|
||||
base.Initialize(sysManager);
|
||||
_pulling = sysManager.GetEntitySystem<PullingSystem>();
|
||||
_pullableQuery = _entManager.GetEntityQuery<PullableComponent>();
|
||||
}
|
||||
|
||||
public override void Startup(NPCBlackboard blackboard)
|
||||
{
|
||||
base.Startup(blackboard);
|
||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||
|
||||
_pulling.TryStopPull(owner, _pullableQuery.GetComponent(owner), owner);
|
||||
}
|
||||
|
||||
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
||||
{
|
||||
return HTNOperatorStatus.Finished;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user