]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Being grappled with a grapple gun allows you to cross chasms (#39983)
authorHayden <banditoz@protonmail.com>
Mon, 8 Sep 2025 00:34:00 +0000 (18:34 -0600)
committerGitHub <noreply@github.com>
Mon, 8 Sep 2025 00:34:00 +0000 (17:34 -0700)
* Being grappled with a grapple gun allows you to cross chasms

Closes #31698

* Update Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs

AAAAAAAAAAAAAAAAA

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Shared/Chasm/ChasmSystem.cs
Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs

index 86b8d4fc4d778c6a563c467d2c3bc828391bd4d4..ab5c32eddd5d271d938ebd75bd04e5ed519e5a0b 100644 (file)
@@ -1,11 +1,9 @@
 using Content.Shared.ActionBlocker;
-using Content.Shared.Buckle.Components;
 using Content.Shared.Movement.Events;
 using Content.Shared.StepTrigger.Systems;
-using Robust.Shared.Audio;
+using Content.Shared.Weapons.Misc;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Network;
-using Robust.Shared.Physics.Components;
 using Robust.Shared.Timing;
 
 namespace Content.Shared.Chasm;
@@ -19,6 +17,7 @@ public sealed class ChasmSystem : EntitySystem
     [Dependency] private readonly ActionBlockerSystem _blocker = default!;
     [Dependency] private readonly INetManager _net = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
+    [Dependency] private readonly SharedGrapplingGunSystem _grapple = default!;
 
     public override void Initialize()
     {
@@ -69,6 +68,12 @@ public sealed class ChasmSystem : EntitySystem
 
     private void OnStepTriggerAttempt(EntityUid uid, ChasmComponent component, ref StepTriggerAttemptEvent args)
     {
+        if (_grapple.IsEntityHooked(args.Tripper))
+        {
+            args.Cancelled = true;
+            return;
+        }
+
         args.Continue = true;
     }
 
index d27efa4d76a76ba4f16f468aa67100cdf22573e8..af4a376bd0171341ad40603104c795422e5abd31 100644 (file)
@@ -40,6 +40,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
         SubscribeLocalEvent<CanWeightlessMoveEvent>(OnWeightlessMove);
         SubscribeAllEvent<RequestGrapplingReelMessage>(OnGrapplingReel);
 
+        // TODO: After step trigger refactor, dropping a grappling gun should manually try and activate step triggers it's suppressing.
         SubscribeLocalEvent<GrapplingGunComponent, GunShotEvent>(OnGrapplingShot);
         SubscribeLocalEvent<GrapplingGunComponent, ActivateInWorldEvent>(OnGunActivate);
         SubscribeLocalEvent<GrapplingGunComponent, HandDeselectedEvent>(OnGrapplingDeselected);
@@ -203,6 +204,25 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
         }
     }
 
+    /// <summary>
+    /// Checks whether the entity is hooked to something via grappling gun.
+    /// </summary>
+    /// <param name="entity">Entity to check.</param>
+    /// <returns>True if hooked, false otherwise.</returns>
+    public bool IsEntityHooked(Entity<JointRelayTargetComponent?> entity)
+    {
+        if (!Resolve(entity, ref entity.Comp))
+            return false;
+
+        foreach (var uid in entity.Comp.Relayed)
+        {
+            if (HasComp<GrapplingGunComponent>(uid))
+                return true;
+        }
+
+        return false;
+    }
+
     private void OnGrappleCollide(EntityUid uid, GrapplingProjectileComponent component, ref ProjectileEmbedEvent args)
     {
         if (!Timing.IsFirstTimePredicted)