Skip to content

Commit

Permalink
fix(binoculars): Allow zooming to be predicted
Browse files Browse the repository at this point in the history
I've tested this with `net_fakelag 400` and boy does it make a
difference.

Additionally this should fix #1625 by doing a sanity check of the
binoculars owner before setting the owners FOV.
  • Loading branch information
Histalek committed Dec 10, 2024
1 parent c60ac9d commit 474c690
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Fixed client error for a not fully initialized client (by @Histalek)
- Fixed the targetID corpse hint not respecting `ttt_identify_body_woconfirm` (by @Histalek)
- Fixed the beacon not being properly translated when placed (by @Histalek)
- Fixed binoculars zooming not being predicted (by @Histalek)

### Changed

Expand Down
11 changes: 4 additions & 7 deletions gamemodes/terrortown/entities/weapons/weapon_ttt_binoculars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,12 @@ end
---
-- @ignore
function SWEP:SetZoomLevel(level)
if CLIENT then
return
end

local owner = self:GetOwner()

self:SetZoomAmount(level)

owner:SetFOV(self.ZoomLevels[level], 0.3)
local owner = self:GetOwner()
if IsValid(owner) then
owner:SetFOV(self.ZoomLevels[level], 0.3)
end
end

---
Expand Down

0 comments on commit 474c690

Please sign in to comment.