]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
make pulled uncuffing slower & reduce uncuff spam cooldown (#29008)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sat, 15 Jun 2024 04:01:22 +0000 (00:01 -0400)
committerGitHub <noreply@github.com>
Sat, 15 Jun 2024 04:01:22 +0000 (21:01 -0700)
* prevent people being pulled from uncuffing themselves

* block -> modify duration

Content.Shared/Cuffs/Components/HandcuffComponent.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs
Content.Shared/Movement/Pulling/Systems/PullingSystem.cs
Resources/Prototypes/Entities/Objects/Misc/handcuffs.yml

index 30577da064f7da5ac830db304a226a017245120c..289f587239b5634ce79212b8901e14fc9db729b9 100644 (file)
@@ -105,3 +105,9 @@ public record struct UncuffAttemptEvent(EntityUid User, EntityUid Target)
     public readonly EntityUid Target = Target;
     public bool Cancelled = false;
 }
+
+/// <summary>
+/// Event raised on an entity being uncuffed to determine any modifiers to the amount of time it takes to uncuff them.
+/// </summary>
+[ByRefEvent]
+public record struct ModifyUncuffDurationEvent(EntityUid User, EntityUid Target, float Duration);
index 1ced3c8d6cb859a5d9c0d1b06dde24b72a9d73ae..0e506f938e65af0f3fe37544a200f97f85b57276 100644 (file)
@@ -561,7 +561,10 @@ namespace Content.Shared.Cuffs
                 return;
             }
 
-            var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime;
+
+            var ev = new ModifyUncuffDurationEvent(user, target, isOwner ? cuff.BreakoutTime : cuff.UncuffTime);
+            RaiseLocalEvent(user, ref ev);
+            var uncuffTime = ev.Duration;
 
             if (isOwner)
             {
index 225810daed2f24288a436d039da1467ee6112ac1..161868370eaddca85b8c285794fc3da14a668dc3 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.ActionBlocker;
 using Content.Shared.Administration.Logs;
 using Content.Shared.Alert;
 using Content.Shared.Buckle.Components;
+using Content.Shared.Cuffs.Components;
 using Content.Shared.Database;
 using Content.Shared.Hands;
 using Content.Shared.Hands.EntitySystems;
@@ -12,6 +13,7 @@ using Content.Shared.Movement.Events;
 using Content.Shared.Movement.Pulling.Components;
 using Content.Shared.Movement.Pulling.Events;
 using Content.Shared.Movement.Systems;
+using Content.Shared.Popups;
 using Content.Shared.Pulling.Events;
 using Content.Shared.Standing;
 using Content.Shared.Throwing;
@@ -43,6 +45,7 @@ public sealed class PullingSystem : EntitySystem
     [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
     [Dependency] private readonly SharedInteractionSystem _interaction = default!;
     [Dependency] private readonly SharedPhysicsSystem _physics = default!;
+    [Dependency] private readonly SharedPopupSystem _popup = default!;
 
     public override void Initialize()
     {
@@ -56,6 +59,7 @@ public sealed class PullingSystem : EntitySystem
         SubscribeLocalEvent<PullableComponent, JointRemovedEvent>(OnJointRemoved);
         SubscribeLocalEvent<PullableComponent, GetVerbsEvent<Verb>>(AddPullVerbs);
         SubscribeLocalEvent<PullableComponent, EntGotInsertedIntoContainerMessage>(OnPullableContainerInsert);
+        SubscribeLocalEvent<PullableComponent, ModifyUncuffDurationEvent>(OnModifyUncuffDuration);
 
         SubscribeLocalEvent<PullerComponent, EntGotInsertedIntoContainerMessage>(OnPullerContainerInsert);
         SubscribeLocalEvent<PullerComponent, EntityUnpausedEvent>(OnPullerUnpaused);
@@ -94,6 +98,18 @@ public sealed class PullingSystem : EntitySystem
         TryStopPull(ent.Owner, ent.Comp);
     }
 
+    private void OnModifyUncuffDuration(Entity<PullableComponent> ent, ref ModifyUncuffDurationEvent args)
+    {
+        if (!ent.Comp.BeingPulled)
+            return;
+
+        // We don't care if the person is being uncuffed by someone else
+        if (args.User != args.Target)
+            return;
+
+        args.Duration *= 2;
+    }
+
     public override void Shutdown()
     {
         base.Shutdown();
index f7038861279c048a56fa545b66633d1d47d1e9a8..a502c7140496cd5a41002e1993e251579b63c310 100644 (file)
@@ -27,7 +27,7 @@
     guides:
     - Security
   - type: UseDelay
-    delay: 30
+    delay: 3
 
 - type: entity
   name: makeshift handcuffs