From 8d4d1002181c4b5da9f40794e7c0de3be443e442 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sat, 8 Jun 2024 17:07:08 +0500 Subject: [PATCH] cleaning --- .../entities/weapons/runnerhands/shared.lua | 2 +- .../gamemodes/beatrun/gamemode/cl/Fall.lua | 4 +-- .../beatrun/gamemode/cl/off/Synesthesia.lua | 2 +- .../gamemode/player_class/player_beatrun.lua | 28 +++++++++++-------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua b/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua index 7f76eec..46ed27d 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua @@ -435,7 +435,7 @@ function SWEP:PrimaryAttack() ply:SetMEMoveLimit(ply:GetMEMoveLimit() * 0.75) ply:SetOverdriveMult(mult) - ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120) * fovmult, 0.125) + ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 100) * fovmult, 0.125) return end diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/Fall.lua b/beatrun/gamemodes/beatrun/gamemode/cl/Fall.lua index eb6be37..7294954 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/Fall.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/Fall.lua @@ -34,7 +34,7 @@ local function FallCheck() ParkourEvent("falluncontrolled", ply, true) end elseif ply.FallStatic and speed > -800 then - ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120)) + ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 100)) ply:StopSound("FallStatic") ply.FallStatic = false @@ -66,7 +66,7 @@ local function FallEffect() blurpass = math.min(blurpass + 0.1, 10) end - ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120) + math.Rand(0, CamShakeMult * 2.5)) + ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 100) + math.Rand(0, CamShakeMult * 2.5)) end end diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/off/Synesthesia.lua b/beatrun/gamemodes/beatrun/gamemode/cl/off/Synesthesia.lua index 744aec6..d9b2b74 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/off/Synesthesia.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/off/Synesthesia.lua @@ -104,7 +104,7 @@ function syn:Think() end local testbuildup = false -local testfovconvar = GetConVar("Beatrun_FOV", 110) +local testfovconvar = GetConVar("Beatrun_FOV", 100) local testfov = 100 local colbeatr = 250 local colbeatg = 120 diff --git a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua index 92e3cf0..bc7e80b 100644 --- a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua +++ b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua @@ -9,7 +9,6 @@ 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 @@ -160,7 +159,7 @@ function PLAYER:Loadout() self.Player:SetJumpPower(230) self.Player:SetCrouchedWalkSpeed(0.5) - self.Player:SetFOV(self.Player:GetInfoNum("Beatrun_FOV", 120)) + self.Player:SetFOV(self.Player:GetInfoNum("Beatrun_FOV", 100)) self.Player:SetCanZoom(false) end @@ -380,17 +379,19 @@ function PLAYER:CalcView(view) if CLIENT then -- VERY hacky and dirty code and I apologize in advance - local fov = GetConVar("Beatrun_FOV"):GetInt() if IsValid(LocalPlayer():GetActiveWeapon()) then - if lframeswepclass != LocalPlayer():GetActiveWeapon():GetClass() then + if lframeswepclass ~= LocalPlayer():GetActiveWeapon():GetClass() then -- SP clientside weapon swap detection FOVModifierBlock = true - timer.Simple(1, function() FOVModifierBlock = false end) + + timer.Simple(1, function() + FOVModifierBlock = false + end) end - if !FOVModifierBlock and !LocalPlayer():GetActiveWeapon().ARC9 then + if not FOVModifierBlock and not LocalPlayer():GetActiveWeapon().ARC9 then fixfovmult = view.fov / fov else fixfovmult = 1 @@ -558,12 +559,13 @@ hook.Add("PlayerSpawn", "ResetStateTransition", function(ply, transition) end) end) -hook.Add("PlayerSwitchWeapon", "BeatrunSwitchFOVFix", function(ply) +hook.Add("PlayerSwitchWeapon", "BeatrunSwitchARC9FOVFix", function(ply) -- This ENTIRE hook is for dealing with ARC9's stupid FOV reset -- behavior after switching away from an ARC9 SWEP. - ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120)) + ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 100)) + timer.Simple(0, function() - ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120)) + ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 100)) end) end) @@ -572,9 +574,11 @@ cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval) LocalPlayer():SetFOV(newval) elseif CLIENT then FOVModifierBlock = true - timer.Create("beatrunfovdelay", 0.16, 1, function() + + timer.Simple(0.16, function() FOVModifierBlock = false - if !FOVModifierBlock then + + if not FOVModifierBlock then net.Start("Beatrun_ClientFOVChange") net.WriteInt(newval, 16) net.SendToServer() @@ -586,7 +590,7 @@ end) if SERVER then net.Receive("Beatrun_ClientFOVChange", function(len, ply) - ply:SetFOV((net.ReadInt(16))) + ply:SetFOV(net.ReadInt(16)) end) end