mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-01-04 08:13:01 +05:00
Compare commits
No commits in common. "3907207dc98cd0e1e59d6e3079e6b37308e2581f" and "fdb3d703bf50ba931a294a31e95ff1138865bbc9" have entirely different histories.
3907207dc9
...
fdb3d703bf
1 changed files with 8 additions and 52 deletions
|
@ -7,13 +7,6 @@ if CLIENT then
|
||||||
CreateConVar("cl_weaponcolor", "0.30 1.80 2.10", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The value is a Vector - so between 0-1 - not between 0-255")
|
CreateConVar("cl_weaponcolor", "0.30 1.80 2.10", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The value is a Vector - so between 0-1 - not between 0-255")
|
||||||
CreateConVar("cl_playerskin", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The skin to use, if the model has any")
|
CreateConVar("cl_playerskin", "0", {FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_DONTRECORD}, "The skin 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")
|
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
|
end
|
||||||
|
|
||||||
local PLAYER = {}
|
local PLAYER = {}
|
||||||
|
@ -375,32 +368,17 @@ function PLAYER:CreateMove(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
function PLAYER:CalcView(view)
|
function PLAYER:CalcView(view)
|
||||||
|
local fov = GetConVar("Beatrun_FOV"):GetInt()
|
||||||
local mult = (self.Player:InOverdrive() and 1.1) or 1
|
local mult = (self.Player:InOverdrive() and 1.1) or 1
|
||||||
local fixfovmult = 1
|
local fixfovmult = 1
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
-- VERY hacky and dirty code and I apologize in advance
|
if !LocalPlayer():GetActiveWeapon().ARC9 and !FOVModifierBlock then
|
||||||
|
fixfovmult = view.fov / fov
|
||||||
local fov = GetConVar("Beatrun_FOV"):GetInt()
|
|
||||||
|
|
||||||
if IsValid(LocalPlayer():GetActiveWeapon()) then
|
|
||||||
if lframeswepclass != LocalPlayer():GetActiveWeapon():GetClass() then
|
|
||||||
-- SP clientside weapon swap detection
|
|
||||||
FOVModifierBlock = true
|
|
||||||
timer.Simple(1, function() FOVModifierBlock = false end)
|
|
||||||
end
|
|
||||||
|
|
||||||
if !FOVModifierBlock and !LocalPlayer():GetActiveWeapon().ARC9 then
|
|
||||||
fixfovmult = view.fov / fov
|
|
||||||
else
|
|
||||||
fixfovmult = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
view.fov = fov * mult * fixfovmult
|
|
||||||
lframeswepclass = LocalPlayer():GetActiveWeapon():GetClass()
|
|
||||||
else
|
else
|
||||||
view.fov = fov * mult
|
fixfovmult = 1
|
||||||
end
|
end
|
||||||
|
view.fov = fov * mult * fixfovmult
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.TauntCam:CalcView(view, self.Player, self.Player:IsPlayingTaunt()) then return true end
|
if self.TauntCam:CalcView(view, self.Player, self.Player:IsPlayingTaunt()) then return true end
|
||||||
|
@ -558,39 +536,17 @@ hook.Add("PlayerSpawn", "ResetStateTransition", function(ply, transition)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hook.Add("PlayerSwitchWeapon", "BeatrunSwitchFOVFix", function(ply)
|
hook.Add("PlayerSwitchWeapon", "BeatrunSwitchFOVFix", function(ply, oldwep)
|
||||||
-- This ENTIRE hook is for dealing with ARC9's stupid FOV reset
|
-- This ENTIRE hook is for dealing with ARC9's stupid FOV reset
|
||||||
-- behavior after switching away from an ARC9 SWEP.
|
-- behavior after switching away from an ARC9 SWEP.
|
||||||
|
|
||||||
-- Yes this is hacky as hell.
|
-- Yes this is hacky as hell.
|
||||||
|
FOVModifierBlock = true
|
||||||
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
||||||
timer.Simple(0, function()
|
timer.Simple(0, function()
|
||||||
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
||||||
end)
|
end)
|
||||||
|
timer.Simple(0.8, function() FOVModifierBlock = false end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
|
|
||||||
-- 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")
|
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default")
|
||||||
|
|
Loading…
Reference in a new issue