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;
[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()
{
private void OnStepTriggerAttempt(EntityUid uid, ChasmComponent component, ref StepTriggerAttemptEvent args)
{
+ if (_grapple.IsEntityHooked(args.Tripper))
+ {
+ args.Cancelled = true;
+ return;
+ }
+
args.Continue = true;
}
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);
}
}
+ /// <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)