ARC9 FOV (proper) fix (#203)

This commit is contained in:
c4nk_ 2024-06-24 19:25:52 +05:00 committed by GitHub
parent bdc423fed5
commit 78f949eb66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 24 deletions

View file

@ -11,9 +11,9 @@ if CLIENT then
local lframeswepclass = lframeswepclass or ""
end
if SERVER then
--[[if SERVER then
util.AddNetworkString("Beatrun_ClientFOVChange")
end
end]]
local PLAYER = {}
@ -25,7 +25,8 @@ PLAYER.TauntCam = TauntCamera()
PLAYER.WalkSpeed = 200
PLAYER.RunSpeed = 400
local FOVModifierBlock = false -- trust me this is important -losttrackpad
--local FOVModifierBlock = false -- trust me this is important -losttrackpad
-- its not important, in-fact -c4nk
function PLAYER:SetupDataTables()
BaseClass.SetupDataTables(self)
@ -377,28 +378,22 @@ function PLAYER:CalcView(view)
local mult = (self.Player:InOverdrive() and 1.1) or 1
local fixfovmult = 1
-- this is the code i added as a comment
--[[local fov = GetConVar("Beatrun_FOV"):GetInt()
view.fov = fov * mult * fixfovmult]]
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
-- SP clientside weapon swap detection
FOVModifierBlock = true
timer.Simple(1, function()
FOVModifierBlock = false
end)
end
if not FOVModifierBlock and not LocalPlayer():GetActiveWeapon().ARC9 then
fixfovmult = view.fov / fov
if LocalPlayer():GetActiveWeapon().ARC9 then
-- the issue was this line that got replaced by this message, you created a problem somehow lol
else
fixfovmult = 1
end
view.fov = fov * mult * fixfovmult
lframeswepclass = LocalPlayer():GetActiveWeapon():GetClass()
else
view.fov = fov * mult
end
@ -569,7 +564,9 @@ hook.Add("PlayerSwitchWeapon", "BeatrunSwitchARC9FOVFix", function(ply)
end)
end)
cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
-- you created more issues by adding this, so i commented it :P
--[[cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
if CLIENT and game.SinglePlayer() then
LocalPlayer():SetFOV(newval)
elseif CLIENT then
@ -587,11 +584,10 @@ cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
end)
end
end)
if SERVER then
net.Receive("Beatrun_ClientFOVChange", function(len, ply)
ply:SetFOV(net.ReadInt(16))
end)
end
end]]
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default")

View file

@ -83,7 +83,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ply:SetGrappleLength(mv:GetOrigin():Distance(trout.HitPos))
ply:SetWallrunCount(0)
ply:SetJumpTurn(false)
ply:SetCrouchJumpBlocked(false)
ply:SetCrouchJumpBlocked(true)
ply:SetNW2Entity("grappleEntity", trout.Entity)
ply:SetNW2Bool("grappledNonCourse", true)
@ -126,6 +126,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ply:SetNW2Bool("grappledNonCourse", false)
ply:SetGrappling(false)
ply:SetCrouchJumpBlocked(false)
if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("mirrorsedge/zipline_detach.wav", 40, 100 + math.random(-25, 10))
@ -336,4 +337,4 @@ local function Swingrope(ply, mv, cmd)
end
end
hook.Add("SetupMove", "Swingrope", Swingrope)
hook.Add("SetupMove", "Swingrope", Swingrope)

View file

@ -141,10 +141,8 @@ local function ZiplineThink(ply, mv, cmd, zipline)
if fraction >= 1 or cmd:KeyDown(IN_DUCK) then
ply:SetZipline(nil)
ply:SetMoveType(MOVETYPE_WALK)
ply:SetCrouchJumpBlocked(true)
mv:SetVelocity(dir * speed * 0.75)
mv:SetButtons(0)
ply:SetZiplineDelay(CurTime() + 0.75)
@ -282,4 +280,4 @@ if CLIENT then
LocalPlayer():StopSound("ZiplineLoop")
end
end)
end
end