FP when FullUpdate fixes

This commit is contained in:
Fesiug 2024-09-21 16:53:28 -04:00
parent ae0481e9a3
commit dc3d3d815e
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
1 changed files with 34 additions and 2 deletions

View File

@ -88,19 +88,51 @@ function GM:CalcView( ply, pos, ang, fov )
local bid = ply:LookupBone("DEF-spine.005")
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
lastfp = fp
print("show")
-- print("show")
elseif !lastfp and fp then
local bid = ply:LookupBone("DEF-spine.006")
ply:ManipulateBoneScale( bid, vector_origin )
local bid = ply:LookupBone("DEF-spine.005")
ply:ManipulateBoneScale( bid, vector_origin )
lastfp = fp
print("hide")
-- print("hide")
end
return view
end
-- During a full update, bone manipulations will be reset to the server's value. Fix that
gameevent.Listen( "OnRequestFullUpdate" )
hook.Add( "OnRequestFullUpdate", "Benny_OnRequestFullUpdate_CameraFP", function( data )
if CLIENT then
local ply = LocalPlayer()
if !ply:IsValid() then return end
local fp = cam_fp:GetBool()
if lastfp == nil then lastfp = !fp end
timer.Simple( 0, function()
if !fp then
local bid = ply:LookupBone("DEF-spine.006")
if !bid then return end
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
local bid = ply:LookupBone("DEF-spine.005")
if !bid then return end
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
lastfp = fp
-- print("fullupdate: show")
elseif fp then
local bid = ply:LookupBone("DEF-spine.006")
if !bid then return end
ply:ManipulateBoneScale( bid, vector_origin )
local bid = ply:LookupBone("DEF-spine.005")
if !bid then return end
ply:ManipulateBoneScale( bid, vector_origin )
lastfp = fp
-- print("fullupdate: hide")
end
end)
end
end )
hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
local p = LocalPlayer()
local w = p:HandlerCheck()