mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-03-01 01:39: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")
|
CreateConVar("cl_playerbodygroups", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The bodygroups to use, if the model has any")
|
||||||
|
|
||||||
local lframeswepclass = lframeswepclass or ""
|
local lframeswepclass = lframeswepclass or ""
|
||||||
|
local fovdelaytoggle = false
|
||||||
|
end
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
util.AddNetworkString("Beatrun_ClientFOVChange")
|
||||||
end
|
end
|
||||||
|
|
||||||
local PLAYER = {}
|
local PLAYER = {}
|
||||||
|
@ -565,10 +570,27 @@ hook.Add("PlayerSwitchWeapon", "BeatrunSwitchFOVFix", function(ply)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
|
cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
|
||||||
-- Fixes live FOV changes. I'm not kidding.
|
-- Live FOV change in SP, needs work for MP
|
||||||
if CLIENT then
|
if CLIENT and game.SinglePlayer() then
|
||||||
LocalPlayer():SetFOV(newval)
|
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
|
||||||
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")
|
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default")
|
||||||
|
|
Loading…
Reference in a new issue