Browse Source

Prevent skipping SetMoveDone call

hltopdown
mittorn 6 years ago committed by Alibek Omarov
parent
commit
c041db9909
  1. 7
      dlls/subs.cpp

7
dlls/subs.cpp

@ -407,6 +407,13 @@ void CBaseToggle::LinearMove( Vector vecDest, float flSpeed ) @@ -407,6 +407,13 @@ void CBaseToggle::LinearMove( Vector vecDest, float flSpeed )
// divide vector length by speed to get time to reach dest
float flTravelTime = vecDestDelta.Length() / flSpeed;
if( flTravelTime < 0.05 )
{
UTIL_SetOrigin( pev, m_vecFinalDest );
LinearMoveDone();
return;
}
// set nextthink to trigger a call to LinearMoveDone when dest is reached
pev->nextthink = pev->ltime + flTravelTime;
SetThink( &CBaseToggle::LinearMoveDone );

Loading…
Cancel
Save