Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ai stays seated and pulled while cuffed. #30397

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.ActionBlocker;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;

namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
Expand All @@ -7,6 +8,7 @@ public sealed partial class UnPullOperator : HTNOperator
{
[Dependency] private readonly IEntityManager _entManager = default!;
private PullingSystem _pulling = default!;
private ActionBlockerSystem _actionBlocker = default!;

private EntityQuery<PullableComponent> _pullableQuery;

Expand All @@ -16,6 +18,7 @@ public sealed partial class UnPullOperator : HTNOperator
public override void Initialize(IEntitySystemManager sysManager)
{
base.Initialize(sysManager);
_actionBlocker = sysManager.GetEntitySystem<ActionBlockerSystem>();
_pulling = sysManager.GetEntitySystem<PullingSystem>();
_pullableQuery = _entManager.GetEntityQuery<PullableComponent>();
}
Expand All @@ -25,7 +28,8 @@ public override void Startup(NPCBlackboard blackboard)
base.Startup(blackboard);
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);

_pulling.TryStopPull(owner, _pullableQuery.GetComponent(owner), owner);
if (_actionBlocker.CanInteract(owner, owner)) //prevents handcuffed monkeys from pulling etc.
_pulling.TryStopPull(owner, _pullableQuery.GetComponent(owner), owner);
}

public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Buckle.Systems;
using Content.Server.Buckle.Systems;

namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;

Expand All @@ -19,7 +19,7 @@ public override void Startup(NPCBlackboard blackboard)
{
base.Startup(blackboard);
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
_buckle.Unbuckle(owner, null);
_buckle.TryUnbuckle(owner, owner, false);
}

public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Cuffs/SharedCuffableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private void OnBuckleAttempt(Entity<CuffableComponent> ent, EntityUid? user, ref
if (cancelled || user != ent.Owner)
return;

if (!TryComp<HandsComponent>(ent, out var hands) || ent.Comp.CuffedHandCount != hands.Count)
if (!TryComp<HandsComponent>(ent, out var hands) || ent.Comp.CuffedHandCount <= hands.Count)
return;

cancelled = true;
Expand Down
Loading