From f24949a0b0cf2adace76bbfefa9f6df91303f67a Mon Sep 17 00:00:00 2001 From: IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com> Date: Thu, 8 Aug 2024 05:53:07 -0400 Subject: [PATCH] ai stays seated and pulled while cuffed. (#30397) * ai stays seated while cuffed. * Do the thing I thought was dumb.... whatever. * less than --- .../HTN/PrimitiveTasks/Operators/Combat/UnPullOperator.cs | 8 ++++++-- .../PrimitiveTasks/Operators/Combat/UnbuckleOperator.cs | 4 ++-- Content.Shared/Cuffs/SharedCuffableSystem.cs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnPullOperator.cs b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnPullOperator.cs index 54f422fe67de..467ac0d41426 100644 --- a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnPullOperator.cs +++ b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnPullOperator.cs @@ -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; @@ -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 _pullableQuery; @@ -16,6 +18,7 @@ public sealed partial class UnPullOperator : HTNOperator public override void Initialize(IEntitySystemManager sysManager) { base.Initialize(sysManager); + _actionBlocker = sysManager.GetEntitySystem(); _pulling = sysManager.GetEntitySystem(); _pullableQuery = _entManager.GetEntityQuery(); } @@ -25,7 +28,8 @@ public override void Startup(NPCBlackboard blackboard) base.Startup(blackboard); var owner = blackboard.GetValue(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) diff --git a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnbuckleOperator.cs b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnbuckleOperator.cs index 116e8fe7c7f9..b242575a12fc 100644 --- a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnbuckleOperator.cs +++ b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnbuckleOperator.cs @@ -1,4 +1,4 @@ -using Content.Server.Buckle.Systems; +using Content.Server.Buckle.Systems; namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat; @@ -19,7 +19,7 @@ public override void Startup(NPCBlackboard blackboard) { base.Startup(blackboard); var owner = blackboard.GetValue(NPCBlackboard.Owner); - _buckle.Unbuckle(owner, null); + _buckle.TryUnbuckle(owner, owner, false); } public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime) diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index d4cadcdbb84e..b540cc3a376e 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -202,7 +202,7 @@ private void OnBuckleAttempt(Entity ent, EntityUid? user, ref if (cancelled || user != ent.Owner) return; - if (!TryComp(ent, out var hands) || ent.Comp.CuffedHandCount != hands.Count) + if (!TryComp(ent, out var hands) || ent.Comp.CuffedHandCount < hands.Count) return; cancelled = true;