ai stays seated and pulled while cuffed. (#30397)
* ai stays seated while cuffed. * Do the thing I thought was dumb.... whatever. * less than
This commit is contained in:
@@ -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;
|
using Content.Shared.Movement.Pulling.Systems;
|
||||||
|
|
||||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
|
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
|
||||||
@@ -7,6 +8,7 @@ public sealed partial class UnPullOperator : HTNOperator
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
private PullingSystem _pulling = default!;
|
private PullingSystem _pulling = default!;
|
||||||
|
private ActionBlockerSystem _actionBlocker = default!;
|
||||||
|
|
||||||
private EntityQuery<PullableComponent> _pullableQuery;
|
private EntityQuery<PullableComponent> _pullableQuery;
|
||||||
|
|
||||||
@@ -16,6 +18,7 @@ public sealed partial class UnPullOperator : HTNOperator
|
|||||||
public override void Initialize(IEntitySystemManager sysManager)
|
public override void Initialize(IEntitySystemManager sysManager)
|
||||||
{
|
{
|
||||||
base.Initialize(sysManager);
|
base.Initialize(sysManager);
|
||||||
|
_actionBlocker = sysManager.GetEntitySystem<ActionBlockerSystem>();
|
||||||
_pulling = sysManager.GetEntitySystem<PullingSystem>();
|
_pulling = sysManager.GetEntitySystem<PullingSystem>();
|
||||||
_pullableQuery = _entManager.GetEntityQuery<PullableComponent>();
|
_pullableQuery = _entManager.GetEntityQuery<PullableComponent>();
|
||||||
}
|
}
|
||||||
@@ -25,7 +28,8 @@ public sealed partial class UnPullOperator : HTNOperator
|
|||||||
base.Startup(blackboard);
|
base.Startup(blackboard);
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
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)
|
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Buckle.Systems;
|
using Content.Server.Buckle.Systems;
|
||||||
|
|
||||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
|
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Combat;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ public sealed partial class UnbuckleOperator : HTNOperator
|
|||||||
{
|
{
|
||||||
base.Startup(blackboard);
|
base.Startup(blackboard);
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||||
_buckle.Unbuckle(owner, null);
|
_buckle.TryUnbuckle(owner, owner, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ namespace Content.Shared.Cuffs
|
|||||||
if (cancelled || user != ent.Owner)
|
if (cancelled || user != ent.Owner)
|
||||||
return;
|
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;
|
return;
|
||||||
|
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user