From 3288331b74826c71dd71873ce89170492ccda7f5 Mon Sep 17 00:00:00 2001 From: Grom1halo Date: Mon, 15 Jun 2026 16:16:07 +0700 Subject: [PATCH] Redirect gun recoil impulse to vehicle when shooter is buckled Firing a weapon while buckled (e.g. riding a hoverbike) pushed the shooter's body away from the seat, which could exceed the strap's unbuckle distance and throw them off the vehicle. Recoil now applies to whatever the shooter is buckled to instead. --- Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs | 8 ++++++++ 1 file changed, 8 insertions(+) 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;