Skip to content

Commit ec6340d

Browse files
authored
Fixed ghost viewmodels briefly appearing from weapons held by other players (#1806)
Sometimes, random pieces of viewmodels (arms, floating guns) would appear briefly during rounds. Today, I noticed I was able to reliably trigger the bug by making a mimic bot use ironsights while looking towards the center of the map. I couldn't find exactly what the root cause was, but I did find it was the LocalPlayer's viewmodel entity briefly rendering another weapon... This PR patches out the issue. Spectating players in first-person still works fine. Demo of the bug (I'm spamming right-click to make the bot use ironsights): https://github.com/user-attachments/assets/49c7dfa0-4823-47f5-95be-4858198b9e7d
1 parent 798de4c commit ec6340d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
1010
- Fixed the shop search breaking when using certain special characters (by @NickCloudAT)
1111
- Fixed propspec not working (by @wgetJane)
1212
- Fixed a regression in TTT voice chat team colors (see <https://github.com/Facepunch/garrysmod/commit/38b7394ced29ffe318213e580efa4b1090828ac7>)
13+
- Fixed ghost viewmodels briefly appearing from weapons held by other players (by @TW1STaL1CKY)
1314

1415
## [v0.14.3b](https://github.com/TTT-2/TTT2/tree/v0.14.3b) (2025-03-18)
1516

gamemodes/terrortown/entities/weapons/weapon_tttbase.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,11 @@ if CLIENT then
885885
-- affects @{GM:PostDrawViewModel}
886886
-- @realm client
887887
hook.Add("PreDrawViewModel", "TTT2ViewModelHider", function(viewModel, ply, wep)
888+
-- safeguard for ghost viewmodels appearing from weapons held by other players
889+
if wep ~= ply:GetActiveWeapon() then
890+
return true
891+
end
892+
888893
-- note: while ShowDefaultViewModel is set to true in the weapon base, addons such as TFA
889894
-- do not use the weapon base and only implement parts of it to work with TTT. In a perfect
890895
-- world TFA would be updated to fix this issue, but we can also prevent it by explicitly

0 commit comments

Comments
 (0)