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 "" local lframeswepclass = lframeswepclass or ""
end end
if SERVER then --[[if SERVER then
util.AddNetworkString("Beatrun_ClientFOVChange") util.AddNetworkString("Beatrun_ClientFOVChange")
end end]]
local PLAYER = {} local PLAYER = {}
@ -25,7 +25,8 @@ PLAYER.TauntCam = TauntCamera()
PLAYER.WalkSpeed = 200 PLAYER.WalkSpeed = 200
PLAYER.RunSpeed = 400 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() function PLAYER:SetupDataTables()
BaseClass.SetupDataTables(self) BaseClass.SetupDataTables(self)
@ -377,28 +378,22 @@ function PLAYER:CalcView(view)
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
-- this is the code i added as a comment
--[[local fov = GetConVar("Beatrun_FOV"):GetInt()
view.fov = fov * mult * fixfovmult]]
if CLIENT then if CLIENT then
-- VERY hacky and dirty code and I apologize in advance
local fov = GetConVar("Beatrun_FOV"):GetInt() local fov = GetConVar("Beatrun_FOV"):GetInt()
if IsValid(LocalPlayer():GetActiveWeapon()) then if IsValid(LocalPlayer():GetActiveWeapon()) then
if lframeswepclass ~= LocalPlayer():GetActiveWeapon():GetClass() then if LocalPlayer():GetActiveWeapon().ARC9 then
-- SP clientside weapon swap detection -- the issue was this line that got replaced by this message, you created a problem somehow lol
FOVModifierBlock = true
timer.Simple(1, function()
FOVModifierBlock = false
end)
end
if not FOVModifierBlock and not LocalPlayer():GetActiveWeapon().ARC9 then
fixfovmult = view.fov / fov
else else
fixfovmult = 1 fixfovmult = 1
end end
view.fov = fov * mult * fixfovmult view.fov = fov * mult * fixfovmult
lframeswepclass = LocalPlayer():GetActiveWeapon():GetClass()
else else
view.fov = fov * mult view.fov = fov * mult
end end
@ -569,7 +564,9 @@ hook.Add("PlayerSwitchWeapon", "BeatrunSwitchARC9FOVFix", function(ply)
end) end)
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 if CLIENT and game.SinglePlayer() then
LocalPlayer():SetFOV(newval) LocalPlayer():SetFOV(newval)
elseif CLIENT then elseif CLIENT then
@ -587,11 +584,10 @@ cvars.AddChangeCallback("Beatrun_FOV", function(convar, oldval, newval)
end) end)
end end
end) end)
if SERVER then if SERVER then
net.Receive("Beatrun_ClientFOVChange", function(len, ply) net.Receive("Beatrun_ClientFOVChange", function(len, ply)
ply:SetFOV(net.ReadInt(16)) ply:SetFOV(net.ReadInt(16))
end) end)
end end]]
player_manager.RegisterClass("player_beatrun", PLAYER, "player_default") 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:SetGrappleLength(mv:GetOrigin():Distance(trout.HitPos))
ply:SetWallrunCount(0) ply:SetWallrunCount(0)
ply:SetJumpTurn(false) ply:SetJumpTurn(false)
ply:SetCrouchJumpBlocked(false) ply:SetCrouchJumpBlocked(true)
ply:SetNW2Entity("grappleEntity", trout.Entity) ply:SetNW2Entity("grappleEntity", trout.Entity)
ply:SetNW2Bool("grappledNonCourse", true) ply:SetNW2Bool("grappledNonCourse", true)
@ -126,6 +126,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ply:SetNW2Bool("grappledNonCourse", false) ply:SetNW2Bool("grappledNonCourse", false)
ply:SetGrappling(false) ply:SetGrappling(false)
ply:SetCrouchJumpBlocked(false)
if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("mirrorsedge/zipline_detach.wav", 40, 100 + math.random(-25, 10)) ply:EmitSound("mirrorsedge/zipline_detach.wav", 40, 100 + math.random(-25, 10))

View file

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