From a4a2b34386b2f0a2e1fbd07dc39159282a746249 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Mon, 10 Apr 2023 01:53:41 +0500 Subject: [PATCH] Avoid lags using movevar. --- dlls/player.cpp | 1 + pm_shared/pm_shared.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index f011b550..63e11283 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2815,6 +2815,7 @@ void CBasePlayer::Spawn( void ) g_engfuncs.pfnSetPhysicsKeyValue( edict(), "slj", "0" ); g_engfuncs.pfnSetPhysicsKeyValue( edict(), "hl", "1" ); + g_engfuncs.pfnSetPhysicsKeyValue( edict(), "fr", "1" ); pev->fov = m_iFOV = 0;// init field of view. m_iClientFOV = -1; // make sure fov reset is sent diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index d5ad05d5..f84cc9ae 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -3319,7 +3319,8 @@ void PM_Move( struct playermove_s *ppmove, int server ) } // Reset friction after each movement to FrictionModifier Triggers work still. - if( pmove->movetype == MOVETYPE_WALK ) + // Use movevar to avoid lags with different clients and servers. + if( !( pmove->multiplayer && atoi( pmove->PM_Info_ValueForKey( pmove->physinfo, "fr" )) == 0 ) && pmove->movetype == MOVETYPE_WALK ) { pmove->friction = 1.0f; }