Skip to content

Fix: gun recoil unbuckles riders from vehicles#253

Open
Grom1halo wants to merge 1 commit into
Forge-Station:mainfrom
Grom1halo:fix-recoil-buckle-unbuckle
Open

Fix: gun recoil unbuckles riders from vehicles#253
Grom1halo wants to merge 1 commit into
Forge-Station:mainfrom
Grom1halo:fix-recoil-buckle-unbuckle

Conversation

@Grom1halo

Copy link
Copy Markdown

Summary

  • Firing a weapon while buckled to something with a StrapComponent (e.g. riding a hoverbike) applied the recoil impulse directly to the shooter's body.
  • This could push the rider's position past the strap's unbuckleDistanceSquared, causing them to be automatically unbuckled and thrown off the vehicle, especially with high-recoil weapons.
  • Recoil is now redirected to whatever the shooter is currently buckled to (BuckleComponent.BuckledTo), so the kick is absorbed by the vehicle instead of ejecting the rider.

Changes

  • Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs: added a BuckleComponent query and, in CauseImpulse, redirect the recoil target entity to BuckledTo when the shooter is buckled.

Test plan

  • Solution builds (Content.Shared, Content.Server, Content.Client) with no new errors/warnings.
  • Started a local dedicated server + client with the change; connected and entered a round with no errors related to GunComponent/BuckleComponent.
  • In-game: ride a hoverbike, fire a weapon with significant recoil, confirm you stay 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant