]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
ai stays seated and pulled while cuffed. (#30397)
authorIProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
Thu, 8 Aug 2024 09:53:07 +0000 (05:53 -0400)
committerGitHub <noreply@github.com>
Thu, 8 Aug 2024 09:53:07 +0000 (19:53 +1000)
* ai stays seated while cuffed.

* Do the thing I thought was dumb.... whatever.

* less than

Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnPullOperator.cs
Content.Server/NPC/HTN/PrimitiveTasks/Operators/Combat/UnbuckleOperator.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs

index 54f422fe67de43bb6789894a56303c4aed243ccb..467ac0d414269724fad4df269d5b50f683bd64b3 100644 (file)
@@ -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<PullableComponent> _pullableQuery;
 
@@ -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>();
     }
@@ -25,7 +28,8 @@ public sealed partial class UnPullOperator : HTNOperator
         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)
index 116e8fe7c7f992f020a90442a6d345f64d694d66..b242575a12fce5be536b5543e750bbecb1e874e6 100644 (file)
@@ -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 sealed partial class UnbuckleOperator : HTNOperator
     {
         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)
index d4cadcdbb84ec5c5e796e852f695d268bcc51fbf..b540cc3a376e651efd92bf6f1b1048f58e4d7130 100644 (file)
@@ -202,7 +202,7 @@ namespace Content.Shared.Cuffs
             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;