diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index ed634a59577..91521a3b0ff 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -76,6 +76,7 @@ public abstract partial class SharedGunSystem : EntitySystem protected EntityQuery _physQuery; // Mono protected EntityQuery _projQuery; // Mono + protected EntityQuery _buckleQuery; // Mono private EntityQuery _autoShootGunQuery; // Mono private const float InteractNextFire = 0.3f; @@ -118,6 +119,7 @@ public override void Initialize() _physQuery = GetEntityQuery(); // Mono _projQuery = GetEntityQuery(); // Mono + _buckleQuery = GetEntityQuery(); // Mono _autoShootGunQuery = GetEntityQuery(); } @@ -727,6 +729,12 @@ public void CauseImpulse(EntityCoordinates toCoordinates, Entity e impulseCoord = TransformSystem.WithEntityId(impulseCoord, selfXform.ParentUid); var toEnt = impulseCoord.EntityId; + + // Mono - if the shooter is buckled (e.g. riding a vehicle), apply the recoil to whatever + // they're buckled to instead, so the kick doesn't shove them out of their seat. + if (_buckleQuery.TryComp(toEnt, out var buckle) && buckle.BuckledTo is { } buckledTo) + toEnt = buckledTo; + if (!_physQuery.TryComp(toEnt, out var toBody)) return;