mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-02-28 17:29:37 +05:00
Hopefully fix FOV changing
This commit is contained in:
parent
cfdf6fedac
commit
3907207dc9
1 changed files with 24 additions and 2 deletions
|
@ -9,6 +9,11 @@ if CLIENT then
|
|||
CreateConVar("cl_playerbodygroups", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The bodygroups to use, if the model has any")
|
||||
|
||||
local lframeswepclass = lframeswepclass or ""
|
||||
local fovdelaytoggle = false
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString("Beatrun_ClientFOVChange")
|
||||
end
|
||||
|
||||
local PLAYER = {}
|
||||
|
@ -565,10 +570,27 @@ hook.Add("PlayerSwitchWeapon", "BeatrunSwitchFOVFix", function(ply)
|
|||
end)
|
||||
|
||||
cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
|
||||
-- Fixes live FOV changes. I'm not kidding.
|
||||
if CLIENT then
|
||||
-- Live FOV change in SP, needs work for MP
|
||||
if CLIENT and game.SinglePlayer() then
|
||||
LocalPlayer():SetFOV(newval)
|
||||
elseif CLIENT then
|
||||
FOVModifierBlock = true
|
||||
timer.Create("beatrunfovdelay", 0.16, 1, function()
|
||||
FOVModifierBlock = false
|
||||
if !FOVModifierBlock then
|
||||
net.Start("Beatrun_ClientFOVChange")
|
||||
net.WriteInt(newval, 16)
|
||||
net.SendToServer()
|
||||
FOVModifierBlock = true
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
if SERVER then
|
||||
net.Receive("Beatrun_ClientFOVChange", function(len, ply)
|
||||
ply:SetFOV((net.ReadInt(16)))
|
||||
end)
|
||||
end
|
||||
|
||||
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default")
|
||||
|
|
Loading…
Reference in a new issue