Skip to content

Conversation

@Rainyan
Copy link
Collaborator

@Rainyan Rainyan commented Sep 22, 2025

Description

There was an issue where players would appear to have weapons like pistols or grenades floating around them, as reported in #1274 For this particular report with the demo replay, this turned out to be a case where we were rendering the weapons of the player spectating the living player, and for whatever reason that spectator still had items in their inventory, and those items were then rendered hovering/flying around the world at the spectator's position.

This PR addresses the bug by preventing dead players from "bumping" weapons, and should they still for whatever reason have a weapon, prevents that weapon from being drawn in the world.

Steps to reproduce

  • Download the demo file from the issue Floating weapons #1274 (comment)
  • Checkout to git tag v17.0-alpha to have a build compatible with the demo
  • Load the demo with demoui, or hotkey Shift+F2
  • Jump to tick 20000
  • Watch the demo until tick 33000 or so

What happens

  • Floating guns are seen

What should happen with this patch applied

  • Floating guns are not seen
  • If you want to verify this, note that you'll have to cherry-pick the patch on top of v17 to be compatible with the demo file, most likely!

Toolchain

  • Windows MSVC VS2022

Linked Issues

We had a bug where the dead spectators could somehow end up possessing
weapons, and these weapons would then appear floating around the world
wherever the spectators flew. This is just a failsafe to stop rendering
such guns, should that ever happen.

We also have a ::BumpWeapon safety check in place now, so hopefully the
spectators should no longer be able to end up with a weapon in their
inventory in the first place, but you never know...
@Rainyan Rainyan requested a review from a team September 22, 2025 19:34
@AdamTadeusz AdamTadeusz requested a review from a team September 22, 2025 20:14
@AdamTadeusz
Copy link
Contributor

AdamTadeusz commented Sep 22, 2025

I tried some shenanigans in response to this where I change teams/go spectate specifically while my character's ent_bbox is inside a weapon but I guess the reproduction step is still more complicated than that

@Rainyan Rainyan merged commit 20b5821 into NeotokyoRebuild:master Sep 23, 2025
7 checks passed
@Rainyan Rainyan deleted the bug/floating-guns branch September 23, 2025 05:12
@Rainyan Rainyan mentioned this pull request Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating weapons

3 participants