From dc3d3d815e85bc4f491436355215c440788b362f Mon Sep 17 00:00:00 2001 From: Fesiug Date: Sat, 21 Sep 2024 16:53:28 -0400 Subject: [PATCH] FP when FullUpdate fixes --- gamemodes/benny/gamemode/camera.lua | 36 +++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/gamemodes/benny/gamemode/camera.lua b/gamemodes/benny/gamemode/camera.lua index 690f0b2..0a768b7 100644 --- a/gamemodes/benny/gamemode/camera.lua +++ b/gamemodes/benny/gamemode/camera.lua @@ -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()